Opened 8 months ago

Closed 7 months ago

#15904 closed defect (fixed)

Cannot redock an AUI panel on wxGTK-3.0.0

Reported by: mdefreitas Owned by:
Priority: high Milestone: 3.0.1
Component: wxGTK Version: 3.0.0
Keywords: bisect-needed regression Cc:
Blocked By: Blocking:
Patch: yes

Description

In my transition to wxWidgets 3.0.0, I noticed a problem in my application which can be replicated in the auidemo sample.

Once a panel is undocked and made floating, it cannot be (or is almost impossible) to redock. If it is temporarily undocked but never made floating, that is, it is dragged out and back in with one motion, than it can be redocked. Once it is completely floating, however, it cannot be docked.

I am using wxGTK-3.0.0 on SUSE Linux SLES 10. This worked at least until wxGTK-2.8.12.

There seems to be some possible related tickets: 14086, 14223

Change History (5)

comment:1 Changed 8 months ago by vadz

  • Keywords bisect-needed regression added
  • Milestone set to 3.0.1
  • Status changed from new to confirmed

I don't think these tickets are relevant because the problem is wxGTK-specific, at least things still work just fine in wxMSW.

It would be great if someone could take time to run a bisection to find out when exactly was this problem introduced.

comment:2 follow-up: Changed 8 months ago by vadz

  • Component changed from wxAui to wxGTK
  • Patch set

Debugging shows that this is due to not receiving wxEVT_MOVE in wxAuiFloatingFrame at all under GTK. And debugging further shows that this is because move events are always filtered out by the code in wxTopLevelWindowGTK::GTKConfigureEvent() which only sends them if the current position changed. But it didn't because the code in gtk_window_motion_notify_callback() in source:wxWidgets/trunk/src/gtk/minifram.cpp had already helpfully set it to the new position.

So this patch

  • src/gtk/minifram.cpp

    diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp
    index cc897e7..6b6acad 100644
    a b gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, 
    316316    gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y); 
    317317    x += org_x - win->m_diffX; 
    318318    y += org_y - win->m_diffY; 
    319     win->m_x = x; 
    320     win->m_y = y; 
    321319    gtk_window_move( GTK_WINDOW(win->m_widget), x, y ); 
    322320 
    323321    return TRUE; 

makes docking work again for me. But I'm far from being sure that it's the right solution. For one, if gtk_window_move() already generates wxEVT_MOVE anyhow, why do we send them manually from wxTopLevelWindowGTK::DoSetSize() after calling it? Also, why do we have to move the miniframe manually at all when this doesn't seem to be required for the normal windows?

Paul, any thoughts about the "fix" above? Do you see any problems with it or a better solution? At the very least, this makes it possible to dock AUI windows again which is rather important...

comment:3 Changed 8 months ago by vadz

FWIW the patch in the comment:2 also fixes the problem reported in this message.

comment:4 in reply to: ↑ 2 Changed 7 months ago by pcor

if gtk_window_move() already generates wxEVT_MOVE anyhow, why do we send them manually from wxTopLevelWindowGTK::DoSetSize() after calling it?

Because DoSetSize() must update the position variables, otherwise GetPosition()/etc would report the old values until the WM gets around to actually moving the window and the new position is reported back. Since the variables reflect the new position, the move event will be filtered out so it has to be sent manually.

Also, why do we have to move the miniframe manually at all when this doesn't seem to be required for the normal windows?

Because the miniframe has no WM title bar, it emulates one itself.

comment:5 Changed 7 months ago by PC

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [75826]) Don't update position variables from window dragging code.
Let "configure-event" handler do it so it can also generate proper move events.
closes #15904

Note: See TracTickets for help on using tickets.