diff options
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 17 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 18 |
3 files changed, 29 insertions, 13 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 101dc3037f..3d14db7d0e 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -533,10 +533,9 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era return PoolVector<Vector2>(); } - for (int i = ids.size() - 1; i >= 0; i--) { - if (ids[i] == prev_id) { - return PoolVector<Vector2>(); - } + if (ids.size() == 1 && ids[0] == prev_id) { + // Same ID, nothing to change + return PoolVector<Vector2>(); } Rect2i r = node->get_used_rect(); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 9d1e3291b7..a1e844898e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1339,7 +1339,7 @@ void OS_X11::request_attention() { // // Sets the _NET_WM_STATE_DEMANDS_ATTENTION atom for WM_STATE // Will be unset by the window manager after user react on the request for attention - // + XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); Atom wm_attention = XInternAtom(x11_display, "_NET_WM_STATE_DEMANDS_ATTENTION", False); @@ -1353,6 +1353,7 @@ void OS_X11::request_attention() { xev.xclient.data.l[1] = wm_attention; XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); + XFlush(x11_display); } void OS_X11::get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state) { @@ -2436,7 +2437,19 @@ String OS_X11::get_system_dir(SystemDir p_dir) const { void OS_X11::move_window_to_foreground() { - XRaiseWindow(x11_display, x11_window); + XEvent xev; + Atom net_active_window = XInternAtom(x11_display, "_NET_ACTIVE_WINDOW", False); + + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = x11_window; + xev.xclient.message_type = net_active_window; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; + xev.xclient.data.l[1] = CurrentTime; + + XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); + XFlush(x11_display); } void OS_X11::set_cursor_shape(CursorShape p_shape) { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index c486b732ea..436dda41a4 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1071,22 +1071,26 @@ void PopupMenu::activate_item(int p_item) { pop = Object::cast_to<PopupMenu>(next); } - emit_signal("id_pressed", id); - emit_signal("index_pressed", p_item); - // Hides popup by default; unless otherwise specified // by using set_hide_on_item_selection and set_hide_on_checkable_item_selection + bool need_hide = true; + if (items[p_item].checkable_type) { if (!hide_on_checkable_item_selection) - return; + need_hide = false; } else if (0 < items[p_item].max_states) { if (!hide_on_multistate_item_selection) - return; + need_hide = false; } else if (!hide_on_item_selection) - return; + need_hide = false; - hide(); + emit_signal("id_pressed", id); + emit_signal("index_pressed", p_item); + + if (need_hide) { + hide(); + } } void PopupMenu::remove_item(int p_idx) { |