Programming :: Get String Width In Pixels In Xlib?

Aug 3, 2009

I'm trying to get the width of a string in pixels this way:

Display *disp;
int len;
disp = XOpenDisplay(0);
font = XLoadQueryFont(disp, desc );

[code]....

I'm getting negative numbers as the the pixel length, eg -7275

View 3 Replies


ADVERTISEMENT

Programming :: Fortan Error - Nonnegative Width Required In Format String At - 1

Jun 10, 2010

I'm in the process of debugging and compiling about sixty FORTRAN 95 programs and could use a little bit of your help before my brain is fried and fingers are cramped. Thanks for your time!

I receive the following errors:

Here is my code:

View 5 Replies View Related

Programming :: Adjust Table Width So That It Fits To Page Width

Mar 22, 2010

A couple of days I started using latex and have still one question about the table width. My table is too wide for a page. How can I adjust it so that it fits on the full width of a page? Can I use a command or do I have to specify each column widths by hand?

My table looks like this;

I did try several commands likeextwidth, esizebox, setlength but didn't found the solution yet.

View 2 Replies View Related

Programming :: Get Console Window Width - Why Ioctl Always Return 0 Width

Jul 1, 2010

I use ioctl to get the cosole window size (the SSH window).

I use the following code:

When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.

View 2 Replies View Related

Programming :: Copy String A To String B And Change String B With Toupper() And Count The Chars?

Oct 22, 2010

copy string a to string b and change string b with toupper() and count the chars

View 3 Replies View Related

Ubuntu :: Can't Find Xlib.h - Fatal Error: Xlib.h: No Such File Or Directory

Jun 12, 2011

I'm trying to build a program called Obpager, but I'm getting an error saying I don't have xlib.h. From what I understand, that file is included in libx11-dev, which I have installed. Any idea?

Code:

dagoss@MAGIC-PORT:~/Downloads/obpager-1.8$ make
Compiling src/main.cc
In file included from src/main.cc:33:0:

[code]....

View 2 Replies View Related

Programming :: Pthread - Take String From The Command Line And Creates A Thread To Print The String

May 3, 2011

I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.

[Code]....

One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?

Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.

View 6 Replies View Related

Programming :: Can't Get Xlib Window To Display / What To Do?

Mar 12, 2009

I am having trouble writing an Xlib application that displays a window. The most frustrating thing is that I've written applications like this before, and never had any problems. For some reason I cannot get this program to work properly. I'm running KDE and when I launch the program, a "button" for the application will appear on the application panel, however, no window will display. It is possible to right click on the panel button and select the Close item which will successfully close the window.

The following is source code that when built will exhibit the behaviour described above code...

View 10 Replies View Related

Programming :: Use QPainter Over An Xlib Window?

Jan 15, 2011

Suppose i have an XID of a window. How can i wrap QPainter to draw on this window? I need something like cairo_xlib_surface_create(), but Qt-based.

View 3 Replies View Related

Programming :: Implementing Scrollbar Using Xlib ?

Oct 17, 2010

I am working on xlib project to develop text editor without using help from any of toolkit/widgets.I get stuck in scrollbar.I have no idea how they work and developed.It become more difficult as I am using low-level C library - xlib.

View 1 Replies View Related

Programming :: Mouse Click C++ XLIB

Mar 3, 2009

The code below seems to do a right mouse click (firefox 2.0.0.7) IF I pass it 3, but I cant get it to do a left mouse click?

View 4 Replies View Related

Programming :: Difference Between Xlib And OpenGL?

Dec 6, 2008

I am starting to learn Linux graphical programming. Most of codes in my hands were written based on xlib, which is a kind of old graphic lib. I see some developers more interested in openGL. Then what's the difference between xlib and openGL? And which one is more popular used in which industry area?

View 2 Replies View Related

Programming :: Plot Individual Pixels In A Window?

Apr 6, 2010

It's been a while since I did any kind of graphics programming, but I would like to start learning how to do graphics stuff in *nix. I started reading the GTK+ 2.0 Tutorial, but a) I've only been able to write a small "Hello World" program, and that tested my patience, and b) I'm not seeing anything which allows you to plot a pixel directly. Back before I migrated to Linux, I used the Windows GDI SetPixel() function for plotting pixels sequentially (this was for a small fractal generator). Mostly what I'm asking is if there's any kind of equivalent function in *nix graphics APIs? GTK+? Would I have to deal with SDL/OpenGL?

View 3 Replies View Related

Programming :: Invoke A ButtonPress Event Using XLib?

Nov 17, 2010

I'm working on an application which generates random shapes when clicking on a window. I designed the window using Motif. I want to invoke the ButtonPress Event .

View 1 Replies View Related

Programming :: Read The State By Using _NET_WM_STATE In Xlib?

Oct 8, 2010

i want to get the state of a particular window by using the _NET_WM_STATE atom. i dont know how to use it with XGetProperty.

View 6 Replies View Related

Programming :: Using Sed Replace Line Containing Particular String By A Single String?

Oct 16, 2010

I have a set of lines as ahown below:

Leon went to school
Leon came back from school..
Leon had dinner...

I have to replace the line containing "dinner" by a single string LUNCH...

View 2 Replies View Related

Programming :: Creates String Suffixes Out Of A Reference String?

Feb 25, 2011

I need to creates string suffixes out of a Reference string. for eg. suffixes of abcdefg will be

1)bcdefg
2)cdefg
3)defg
and so on...

create an array of pointers to point to the first few characters and then use that pointer to print the rest of the string.But when i print using the pointer i get GARBAGE values! shudn't std::cout<<ptr[w] print the string following the char it is pointing to? why do i get garbage values?

View 9 Replies View Related

Programming :: C - Put A Specific Arbitrary Part Of A String Into It's Own String?

Apr 18, 2010

So if I'm given a location of a file like:

How can I just take the type of the file at the end? I know I can use strrchr() for a period to get the pointer to the period just before file type. Is there a build in string function that will just take the rest of the string from a certain point on forward in the string? I know it wouldn't be much work to make it myself, but I figured I would find out if it already existed before doing it.

View 9 Replies View Related

Programming :: Convert String To Integer Back To String C++ ?

Mar 13, 2010

Code:

The error is:

Code:

What I want to do is take input of ip4 as a string, convert it to an integer to add 1 to it, then reconvert it back to a string. Its not working.

My full code is:

Code:

View 1 Replies View Related

Programming :: Paint Pixels In C / C++ Without Going In To Object Oriented Prog?

Aug 24, 2009

I want to findout how to paint a line in C without using a line function or OOP. I want to control it by pixels.

View 6 Replies View Related

Programming :: Xlib - C Programming - Get Value From Pixel

Dec 11, 2009

I'm making a game with the xlib library. What I want to do is to know if the character is standing on a trap or something else.

So far I've solved that using the coordinates but when I draw circles or stuff not shaped like a rectangle it gets to hard to make the game exact.

So what I'm asking for is if there is some kind of function in the xlib that tells you which color a pixel has. Because then it'd be much easier.

I've searched but I haven't been able to find anything good. I found XGetPixel() but that appears to work only with images, maybe I can make my window to be an "image"?

View 7 Replies View Related

Programming :: Use Colors In Xlib Programming ?

Apr 27, 2010

I'm trying to understand how to use colors in Xlib programming. What I think I understand so far is that modern displays use 24 or 32-bit TrueColor. And TrueColor uses three colormaps, one for each primary color, and a single pixel value is composed of three indices.

Now the part i'm confused about is how to get my programs to use a 32-bit TrueColor visual. I thought I could inheret the visual from the root window to get color but it seems no matter what pixel value I use it's either black or white.

I guess my question is, how can I setup my programs so that I can specify a pixel value that is a combination of RGB values to get the color I want?

I come from windows where I simply used RGB(r,g,b) macro to specify colors and never had to worry about depth and colormaps and visuals, so I'm a bit overwhelmed by all of these concepts.

View 1 Replies View Related

Programming :: Xlib Documentation With GUI Programming?

Dec 14, 2008

I want to do some experimentation with GUI programming. What mostly interests me is how the toolkits actually work (what are the drawing mechanisms, how it communicates with X, etc.) and how the window managers work. I know it's quite a lot but I don't plan on developing the next best DE/Toolkit/Window Manager, just to play with API, mostly to learn. It seems that there is a shortage of documentation on this topics, I'm trying to find anything for 2 days now with no result.

View 7 Replies View Related

Programming :: Xlib C Program Doesnt Work Every Time

Jul 24, 2010

I tried to draw two lines with xlib.h in C. If I start this compiled program it show me in most cases a window with two lines as it should be.

But sometimes the two lines are not drawn.If I insert XFlush() before the second XSync() it worked better but not every time.Why?How can I solve the problem?How works the X-Server buffer in detail?

Code:

View 1 Replies View Related

Programming :: Selecting VGA Planes Causes Existing Pixels To Change Colors?

Oct 28, 2009

using the code

Code:

void setplane(unsigned char mask){
inportb(0x3DA); //Reset the VGA flip/flop
unsigned char c=inportb(0x3C0); /*the VGA does not like you not saving values*/

[code]....

does not work, for example if setplane(1); will change all pixels plotted to blue - not just the newest. and here is how i plot pixels:

Code:

void ppixel(unsigned x, unsigned y, unsigned char color){
setplane(color);
((char far *)0xA0000000L)[(y*(640/8))+(x/8)]=((1<<7)>>(x%8));
}

View 2 Replies View Related

Programming :: How To Find Out Width Of Terminal

Mar 19, 2010

I wonder how CLI applications know the width of the terminal. For example, how does ls know how many columns to use?

How do package managers like pacman know what length to make the download progress bar?

Also, how do they redraw the progress bar in the same line?

View 11 Replies View Related

Programming :: Assigning Custom String To Std::string In C++?

Oct 12, 2009

I've been given a custom-made string class which handles string, wstring and bstr. It has a number of methods and assignment operators to convert to and from different types. The app I work on compiles happily in VS6 and VS2008, but when trying to compile in Redhat (version 4.1.1 in Redhat 5.0)

[code]....

View 4 Replies View Related

Programming :: How To Check If All Letters Of One String Are In Another String?

Nov 11, 2010

I have the following two type of strings1: A/D2: A/C/DI am trying to write a subroutine to check whether all of the letters in string 1 appears in string 2. If yes, return true. If not, return false. In the above example, all the letters (A and D) in string 1 are also present in string 2, so I return true.

View 4 Replies View Related

Programming :: Get Width/height Of A Terminal Window In C++?

May 28, 2010

How do I find out how many characters fit into a terminal window horizontally and how many lines the terminal window is high (i.e. how many rows and columns are visible - the width and height)? I am using c++ and Linux Mint 8 - Gnome.

View 8 Replies View Related

Programming :: Use Awk And Sed To Extract Height And Width Of File

Aug 3, 2010

I am trying to write commands that extracts the height and width of a video file via ffmpeg. I have the following working so far:

This gives the following answer in widthxheight format with an extra , 720x480,

How can I instead run 2 separate commands that give me height and width separately? I want some command to give me 720 and another command to give me 480 and I dont need the x or the ,

If you need to know this is what ffmpeg -i videofile.mov 2>&1 gives as output

Seems stream 0 codec frame rate differs from container frame rate:

At least one output file must be specified

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved