GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Dec 22, 2014 5:37 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Get display?
PostPosted: Fri Mar 28, 2008 10:48 am 
Offline
Familiar Face

Joined: Wed Mar 19, 2008 3:23 pm
Posts: 19
I have a gtk program with a GtkWindow. Now I want to get the address to the current display, cause I want to use the function
Code:
XF86VidModeGetModeLine(Display *display,
                       int screen,
                       int *dotclock_return,
                       XF86VidModeModeLine *modeline);

To get the current modeline. The dotclock_return and modline variables are set by the function and does not have to be preset.

I have looked at this page and tried to find out which function to use, but every function seems to be connected to some kind of object and I don't know how to get those objects. Isn't it just possible to get a pointer to the current display that is viewing right at the moment or the display that the window is in? I also want to get the number of the screen to be able to call the function properly.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 1:15 pm 
Offline
Familiar Face

Joined: Sun Mar 09, 2008 2:16 pm
Posts: 14
Hello TriKri!

This code should get the display of your GTK-Window:

Code:
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
...
GdkWindow *gdk_window = nameofyourgtkwindow->window;
Display *display = GDK_WINDOW_XDISPLAY (gdk_window);


Make sure that your window is visible before executing this code.

Greetings
Zarg

PS: not 100% sure about the includes ...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 9:13 pm 
Offline
Familiar Face

Joined: Wed Mar 19, 2008 3:23 pm
Posts: 19
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group