From 50d7c71db16a8497058eec69361c80d4e88c7cd6 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Thu, 20 Jul 2023 11:13:01 +0300 Subject: [PATCH] Clarify dragging flags --- src/window_manager.cc | 4 ++-- src/window_manager.h | 10 +++++++--- src/window_manager_private.cc | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/window_manager.cc b/src/window_manager.cc index d9ac144..f3d01ce 100644 --- a/src/window_manager.cc +++ b/src/window_manager.cc @@ -2047,13 +2047,13 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr) } if (button != NULL) { - if ((button->flags & BUTTON_FLAG_0x10) != 0 + if ((button->flags & BUTTON_DRAG_HANDLE) != 0 && (mouseEvent & MOUSE_EVENT_ANY_BUTTON_DOWN) != 0 && (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) { win_drag(window->id); _button_draw(button, window, button->normalImage, true, NULL, true); } - } else if ((window->flags & WINDOW_FLAG_0x80) != 0) { + } else if ((window->flags & WINDOW_DRAGGABLE_BY_BACKGROUND) != 0) { v25 |= mouseEvent << 8; if ((mouseEvent & MOUSE_EVENT_ANY_BUTTON_DOWN) != 0 && (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) { diff --git a/src/window_manager.h b/src/window_manager.h index 265aa7e..99180d7 100644 --- a/src/window_manager.h +++ b/src/window_manager.h @@ -42,8 +42,10 @@ typedef enum WindowFlags { WINDOW_MODAL = 0x10, WINDOW_TRANSPARENT = 0x20, WINDOW_FLAG_0x40 = 0x40, - // Draggable? - WINDOW_FLAG_0x80 = 0x80, + + /// Specifies that the window is draggable by clicking and moving anywhere + /// in its background. + WINDOW_DRAGGABLE_BY_BACKGROUND = 0x80, WINDOW_MANAGED = 0x100, } WindowFlags; @@ -52,7 +54,9 @@ typedef enum ButtonFlags { BUTTON_FLAG_0x02 = 0x02, BUTTON_FLAG_0x04 = 0x04, BUTTON_FLAG_DISABLED = 0x08, - BUTTON_FLAG_0x10 = 0x10, + + /// Specifies that the button is a drag handle for parent window. + BUTTON_DRAG_HANDLE = 0x10, BUTTON_FLAG_TRANSPARENT = 0x20, BUTTON_FLAG_0x40 = 0x40, BUTTON_FLAG_GRAPHIC = 0x010000, diff --git a/src/window_manager_private.cc b/src/window_manager_private.cc index ca11d9b..2f4c706 100644 --- a/src/window_manager_private.cc +++ b/src/window_manager_private.cc @@ -322,7 +322,7 @@ int _win_list_select_at(const char* title, char** items, int itemsLength, ListSe NULL, NULL, NULL, - BUTTON_FLAG_0x10); + BUTTON_DRAG_HANDLE); windowRefresh(win); @@ -885,7 +885,7 @@ int _win_debug(char* string) NULL, NULL, NULL, - BUTTON_FLAG_0x10); + BUTTON_DRAG_HANDLE); } char temp[2];