Advertisement

x equivelant to WIN32 SetWindowLong?

Started by May 30, 2003 06:24 PM
5 comments, last by avianRR 21 years, 5 months ago
anyone know how to store a 32 unsigned int with a window so that any other thread can get the same value back? The win32 version of my code uses. unsigned int MyVal = whatever; SetWindowLong(hWnd,GWL_USERDATA,MyVal); . . . MyVal = GetWindowLong(hWnd,GWL_USERDATA);
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
http://tronche.com/gui/x/xlib/window-information/properties-and-atoms.html
Advertisement
quote: Original post by C-Junkie
http://tronche.com/gui/x/xlib/window-information/properties-and-atoms.html


ok, I''m getting brain fry just trying to understand the basics of that. If there''s a simpler way of doing it please let me know. To be a little more specific on what I need here''s some of the actuall code from the win32 version. If someone could give me a translated version I''d appreciate it otherwise I''ll have to try to figure it out myself. (oh, what fun! not!)

WINDOW::Create(){
hwnd = CreateWindow(...);
.
.
.
SetWindowLong(hwnd,GWL_USERDATA,(long)this);
}

int WINAPI WindProc(HWND hWnd,UINT uMsg,WPARAM wParam,lParam){
WINDOW *Current (WINDOW *)GetWindowLong(hWnd,GWL_USERDATA);

switch(uMsg){
case WM_Destroy:
Current->OnDestroy();
break;
.
.
.
}
return 0;
}

Well, I''m off to try and figure out the atoms thing (hopefully). If anyone can show me an example of how to do this I''d greatly appreciate it.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
I amy have sent you the wrong thing in my haste...

What toolkit are you using, btw?
quote: Original post by C-Junkie
I amy have sent you the wrong thing in my haste...

What toolkit are you using, btw?


wrong thing? well, it would work if I can figure it out.

I don''t know what you mean by tool kit but I''m just using generic xlib for the x stuff and g++ to compile. other than that everything is being written with generic C/C++ code.

using the XSetTextProperty function I found on the site you provided would probably work. I just can''t figure out how to set up the structures for the function call.

If I could find some sample code I could probably figure it out. I just can''t find any sample code.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
Heh,

I think he means get out of the dark ages and use a toolkit, like say GTK for instance.

Xlib was my first real go-around with event-driven programming, and believe me it''s improved with other ''toolkits''.

Just a thought, and unfortunately I''d have to do some research to answer your question because it''s been so long since I''ve touched Xlib.


.zfod
Advertisement
future projects may use gtk (I have a book on it already) however I already have the whole program except these two lines of code working using xlib. I''d hate to have to redo everything just because of that.

I have one more choice, create a linked list with all the display / window combination and then just search for the value in that list. Not the way I wanted to solve it but unless I can figure out atoms it''s the only choice I''ll have.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]

This topic is closed to new replies.

Advertisement