Re: [gtk-list] Getting the X display from a GTK window



> From: Mihai Christodorescu <mihai@cs.ucsb.edu>
> 
> Hi!
> 
> 	I have a main window, and I want to find out the Display structure the
> program is running on, and the screen it is running on (the Display *
> representing the display and the integer representing the screen number).
> 	I dug out a macro called GDK_WINDOW_XDISPLAY which seems to take a
> GdkWindow and return a Display *. Now the problem is that I do not know how
> to extract the GdkWindow out of a GtkWidget. More specifically, I have a
> GtkWindow.
> 	My questions:
> 1. how do I get the GdkWindow from a GtkWidget?
> 2. how do I get the Display * from a GtkWidget or a GdkWindow (if the above
> macro does not work)?
> 3. how do I get the screen number from a GtkWidget?
> 
> TIA,
> 
> Mihai

The answer to question 1 is GtkWidget has a member:

GdkWindow *window;

so you can get it by

GtkWidget *widget;

widget->window;

I don't know the answer to your other questions.

Dave



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]