[gnome-love] Moving a window programmatically?



This isn't really GNOME/GTK elated I guess, but maybe you don't mind me
posting here anyway (in the end the code, if I can get it to work will
end up in a GNOME tool :-).

The following code doesn't do what I want. What am I doing wrong?

 #include <stdio.h>
 
 #define WNCK_I_KNOW_THIS_IS_UNSTABLE
 #include <libwnck/libwnck.h>
 #include <gtk/gtk.h>
 #include <X11/Xlib.h>
 
 int
 main(int argc, char **argv)
 {
     WnckScreen *scr;
     WnckWindow *win;
     int x, y, width, height;
     Display *disp = NULL;
 
     gtk_init(&argc, &argv);
 
     scr = wnck_screen_get_default();
     while(gtk_events_pending()) gtk_main_iteration();
     win = wnck_screen_get_active_window(scr);
     wnck_window_get_geometry(win, &x, &y, &width, &height);
 
     printf("Current geometry: %d,%d %dx%d\n", x, y, width, height);
 
     XMoveWindow(XOpenDisplay(NULL), wnck_window_get_xid(win), 100, 100);
 
     return(0);
 }

The current window (the terminal where I run the compiled program)
stubbornly stays exactly where it is.

/M

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus therning org             Jabber: magnus therning gmail com
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Unreadable code,
Why would anyone use it?
Learn a better way.
     -- Geoff Kuenning's contribution to the 2004 Perl Haiku Contest,
        Haikus about Perl - 'Dishonerable Mention' winner

Attachment: pgpd32CfjsFjr.pgp
Description: PGP signature



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