GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get display?

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
TriKri
Familiar Face


Joined: 19 Mar 2008
Posts: 14

PostPosted: Fri Mar 28, 2008 10:48 am    Post subject: Get display? Reply with quote

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: (Plaintext)
1
2
3
4
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.
Back to top
Zarg
Familiar Face


Joined: 09 Mar 2008
Posts: 10

PostPosted: Fri Mar 28, 2008 1:15 pm    Post subject: Reply with quote

Hello TriKri!

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

Code: (C)
1
2
3
4
5
6
7

#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 ...
Back to top
TriKri
Familiar Face


Joined: 19 Mar 2008
Posts: 14

PostPosted: Fri Mar 28, 2008 9:13 pm    Post subject: Reply with quote

Thanks!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP