Re: Move window event?



On Wed, 9 Apr 2003, John Cupitt wrote:
> Hi,
> 
> Lars Clausen wrote:
>> On request of Windows users and others, I'm trying to add persistent
> window
>> place and size.  For that, I need to get an event when a window is
> moved or
>> resized.  Is there such an event available?  The docs don't seem to
> list
>> one (but then, they're very quiet about the uses of events).
> 
> I have an ungly hack in my app to do this. On popdown I do:
> 
>         window_width = GTK_WIDGET( iv )->allocation.width;
>         window_height = GTK_WIDGET( iv )->allocation.height;
>         gdk_window_get_root_origin( 
>                 gtk_widget_get_toplevel( GTK_WIDGET( iv ) )->window,
>                 &window_x, &window_y );
> 
> and on build I do:
> 
>         gtk_widget_set_uposition( GTK_WIDGET( iv ),
>                 window_x, window_y );
>         gtk_window_set_default_size( GTK_WINDOW( iv ),
>                 window_width, window_height );
> 
> This is gtk+-1.2, not sure if the get_root_origin() stuff is different
> in 2.x.

I was considering that, but some window managers use the destroy signal to
close windows, and then we can't get the position.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



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