Re: how to resize window smaller



On Tue, 2005-10-25 at 23:20 -0400, Carl Nygard wrote:
> Once I've used set_size_request to some size (x,y), I am unable to
> resize the window to some smaller size.  Can someone tell me how to
> accomplish this?  I've tried resize() on the Gdk::Window for both the
> drawingarea and the main toplevel window, nothing seems to work.

For anyone who wants to know the solution, here's what I found.

Basically, after much trial and tribulation, I stumbled across some odd
behavior whereby it would resize the window ever *other* time.  That led
me to think that there might be some main-loop requirements to process
requests so that the resizing didn't get coalesced into one call.  

So the bottom line is that after stumbling across some combination that
worked, and then removing one by one what I thought didn't really
matter, I am left with this:


Code:

        // ...  _mw == toplevel window widget
        //      _drawingArea is what needs to be resized
        _drawingArea->set_size_request(-1, -1);
        while(Gtk::Main::events_pending()){
            cout << "Processing pending events" << endl;
            Gtk::Main::iteration(false);
        }
        _drawingArea->set_size_request(width, height);
        _mw->get_window()->resize(200, 200);
        while(Gtk::Main::events_pending()){
            cout << "Processing pending events" << endl;
            Gtk::Main::iteration(false);
        }
        // ...


The second set_size_request() and resize() calls are interchangeable
order-wise, but are both necessary for proper operation.  Likewise the
while() loops are necessary as well.

Thanks to those who made suggestions, they were what ultimately led me
to finding the correct combination.

Can someone render an opinion on whether this is really just a
work-around for some kind of bug in the resizing code?

Regards,
Carl




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