Author: Date: Subject:
defreitas@gmail.com
2008-07-15 11:35:49
Problems getting/setting TopLevelWindow position
I am trying to save my top level window position on exit and then
restore it when the application restarts. The “config” sample program
does this, but it does not run right on IRIX. This is what is
happening:
The sample program starts up and trys to set its position with Move()
(which eventually calls gtk_window_move()). Rather than setting the
top/left border of the frame to that position, it sets the client area
to that position, thus we are offset to the top and left from the
position we really want to be at.
The function gtk_frame_configure_callback() is invoked which then trys
to set the wxTopLevelWindow position variables (m_x and m_y) via a
call to gdk_window_get_root_origin(). This function returns the true
top-left position of the frame.
When we exit the program we save this new position in a wxConfig
object.
We come up again and we try to set our position with Move. But Move
will set the client area position, which offsets us once again. The
gtk_frame_configure_callback function is invoked which once again sets
the wxTopLevelWindow position variables (m_x and m_y) to what the true
position of the frame is.
What happens is that we continually creep to the top and left over
each run of the executable.
I could put a “kludge” in my code to compensate for these offsets, but
things are not so predictable. Unfortunately, although the
gdk_window_get_root_origin() function normally returns the frame
border's position, it sometimes returns the client area’s position…
and sometimes it returns (0,0).
So…. The main problems are:
gtk_window_move() sets the client area position, not the frame border
position.
gdk_window_get_root_origin() is unpredictable
Any ideas what is going on?
I am using wx-GTK-2.8.8 (with GTK+ 2.4) on IRIX 6.5
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Author: Date: Subject:
defreitas@gmail.com
2008-07-15 14:24:28
Re: Problems getting/setting TopLevelWindow position
I ran this test program and it sets the client area to position 33,33.
I assume this is not what should be happening?
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Hello");
gtk_widget_show(window);
gtk_window_move(GTK_WINDOW(window),1600,33);
gtk_main();
return 0;
}
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Author: Date: Subject:
defreitas@gmail.com
2008-07-15 14:26:45
Re: Problems getting/setting TopLevelWindow position
I ran this test program and it put the client area at position 33,33.
I assume this is not what should be happening?
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Hello");
gtk_widget_show(window);
gtk_window_move(GTK_WINDOW(window),33,33);
gtk_main();
return 0;
}
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Author: Date: Subject:
ATS
2008-07-16 18:28:04
Re: Problems getting/setting TopLevelWindow position
<defreitas <at> gmail.com> writes:
>
> I am trying to save my top level window position on exit and then
> restore it when the application restarts. The “config” sample program
> does this, but it does not run right on IRIX. This is what is
> happening:
>
There's been a lot of work around this issue on the SVN trunk version,
and it's working nicely for me.
Basically, Unix window managers work with client size and the frame
and decorations belongs to the OS. On Windows it work the opposite way,
and the decorations belong to the app.
To get this to work well, a bag of tricks had to be used (and my guess is
that this is not in 2.8.7).
Quite some work went into this, and it's probably a bit of work to
back port.
Regards
// ATS.
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Author: Date: Subject:
defreitas@gmail.com
2008-07-18 10:19:12
Re: Problems getting/setting TopLevelWindow position
On Jul 16, 2:28 pm, ATS <[email protected]> wrote:
> <defreitas <at> gmail.com> writes:
>
>
>
> > I am trying to save my top level window position on exit and then
> > restore it when the application restarts. The “config” sample program
> > does this, but it does not run right on IRIX. This is what is
> > happening:
>
> There's been a lot of work around this issue on the SVN trunk version,
> and it's working nicely for me.
>
> Basically, Unix window managers work with client size and the frame
> and decorations belongs to the OS. On Windows it work the opposite way,
> and the decorations belong to the app.
>
> To get this to work well, a bag of tricks had to be used (and my guess is
> that this is not in 2.8.7).
>
> Quite some work went into this, and it's probably a bit of work to
> back port.
>
> Regards
> // ATS.
Unfortunately, I think my problem is beyond wx and it goes down to the
GTK/GDK level. If I get unpredictable results from
gdk_window_get_root_origin(), then it seems all bets are off.
I wonder if any GDK people might know what is going on... perhaps a
bad window manager setting?
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
Author: Date: Subject:
Vadim Zeitlin
2008-07-18 19:29:04
Re[2]: Problems getting/setting TopLevelWindow position
On Fri, 18 Jul 2008 10:19:12 -0700 (PDT) [email protected] wrote:
> Unfortunately, I think my problem is beyond wx and it goes down to the
> GTK/GDK level. If I get unpredictable results from
> gdk_window_get_root_origin(), then it seems all bets are off.
Yes, there is not much wx can do in this case.
> I wonder if any GDK people might know what is going on...
You should try posting to GTK mailing lists.
Good luck,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
_______________________________________________
wx-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wx-users
|