RE: GTK+ 2.2.0: gtk_window_move(window, 0, 0)



I have recently been experiencing these problems.  With ver 2.x.x (2.0.6 for
RedHat and 2.2.0 for Windows) I have noticed, if I use
gdk_window_move(GDK_WINDOW(window),0,0) it will put the window (from the top
left start of the decorations) in 0,0.  The same code on windows, puts the
client part of the window (i.e. not the decorations) at 0,0.  This is
annoying because the window title bar is then off the screen.

I have made a small function to get round this (below):

gboolean set_positions_callibration()
{
    gint offset_x = 0;
    gint offset_y = 0;

    gdk_window_move(GDK_WINDOW(window),0,0);  
    gdk_window_get_root_origin(GDK_WINDOW(window), &offset_x, &offset_y); 

    pos_offset_x = abs(offset_x);
    pos_offset_y = abs(offset_y);

    return TRUE;
}

and when I move the window, I use:

    gdk_window_move(GDK_WINDOW(window), (pos_offset_x + left), (pos_offset_y
+ top));


this (the callibration function) is only used on windows!  Of all the
gdk_window_ functions, gdk_window_get_root_origin(...) was the only function
that told me -5, -24 when calling it on the window I was interested in, all
the rest returned -1, -1.  I tried the following:

    gdk_window_get_deskrelative_origin(GDK_WINDOW(window), &x, &y); 
    g_message("desk orig pos= x:%d, y:%d", x,y);

    gdk_window_get_origin(GDK_WINDOW(window), &x, &y); 
    g_message("orig pos= x:%d, y:%d", x,y);

    gdk_window_get_root_origin(GDK_WINDOW(window), &x, &y); 
    g_message("root orig pos= x:%d, y:%d", x,y);

    gdk_window_get_position(GDK_WINDOW(window), &x, &y); 
    g_message("pos= x:%d, y:%d", x,y);

    gdk_window_get_geometry(window, &x, &y, &w, &h, &d);
    g_message("geom= x:%d, y:%d, w:%d, h:%d, d:%d", x,y,w,h,d);

Regards,
Martyn

> 
> At 22:29 24.01.03 +0000, Tor Lillqvist wrote:
> >Ken Rastatter writes:
> > > For example, the following simple test program create a TOPLEVEL
> > > window and moves it to (0,0).  One should see the top, left corner
> > > of the GTK window's title bar moved to the top, left corner of the
> > > Windows desktop like this:
> >
> > > However, 2.2.0 moves the top, left corner of the GTK window's
> > > *client area* to the top,
> >
> >(thus leaving the title bar outside the screen)
> >
> >How does GTK+ do this on X11? Do top-level window coordinates and
> >sizes take the window decorations into account or not? I 
> have reasoned
> >one should not take them into account, and that all coordinates and
> >sizes should refer to the so-called client area.
> >
> I always assumed placing the top level window on X11 is window
> manager business. So the rather annoying behaviour of placing
> the windows title bar outside of the screen would mostly only
> visible on win32.
> My workaround in gdk/win32 was the SafeAdjustWindowRect function,
> which now that negative coordinates should become valid probably
> won't work anymore 
> 
> >Or should some mixture be used, for instance so that a top-level
> >window size specifies the client area size, but its coordinates are
> >the decoration's (title bar's) coordinates?
> >
> >--tml
> >
> >
> >_______________________________________________
> >gtk-devel-list mailing list
> >gtk-devel-list gnome org
> >http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> >
> >
> -------- Hans "at" Breuer "dot" Org -----------
> Tell me what you need, and I'll tell you how to 
> get along without it.                -- Dilbert
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 



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