Clarify dragging flags

This commit is contained in:
Alexander Batalov 2023-07-20 11:13:01 +03:00
parent b07a7bcefd
commit 50d7c71db1
3 changed files with 11 additions and 7 deletions

View File

@ -2047,13 +2047,13 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr)
} }
if (button != NULL) { 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_DOWN) != 0
&& (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) { && (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) {
win_drag(window->id); win_drag(window->id);
_button_draw(button, window, button->normalImage, true, NULL, true); _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; v25 |= mouseEvent << 8;
if ((mouseEvent & MOUSE_EVENT_ANY_BUTTON_DOWN) != 0 if ((mouseEvent & MOUSE_EVENT_ANY_BUTTON_DOWN) != 0
&& (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) { && (mouseEvent & MOUSE_EVENT_ANY_BUTTON_REPEAT) == 0) {

View File

@ -42,8 +42,10 @@ typedef enum WindowFlags {
WINDOW_MODAL = 0x10, WINDOW_MODAL = 0x10,
WINDOW_TRANSPARENT = 0x20, WINDOW_TRANSPARENT = 0x20,
WINDOW_FLAG_0x40 = 0x40, 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, WINDOW_MANAGED = 0x100,
} WindowFlags; } WindowFlags;
@ -52,7 +54,9 @@ typedef enum ButtonFlags {
BUTTON_FLAG_0x02 = 0x02, BUTTON_FLAG_0x02 = 0x02,
BUTTON_FLAG_0x04 = 0x04, BUTTON_FLAG_0x04 = 0x04,
BUTTON_FLAG_DISABLED = 0x08, 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_TRANSPARENT = 0x20,
BUTTON_FLAG_0x40 = 0x40, BUTTON_FLAG_0x40 = 0x40,
BUTTON_FLAG_GRAPHIC = 0x010000, BUTTON_FLAG_GRAPHIC = 0x010000,

View File

@ -322,7 +322,7 @@ int _win_list_select_at(const char* title, char** items, int itemsLength, ListSe
NULL, NULL,
NULL, NULL,
NULL, NULL,
BUTTON_FLAG_0x10); BUTTON_DRAG_HANDLE);
windowRefresh(win); windowRefresh(win);
@ -885,7 +885,7 @@ int _win_debug(char* string)
NULL, NULL,
NULL, NULL,
NULL, NULL,
BUTTON_FLAG_0x10); BUTTON_DRAG_HANDLE);
} }
char temp[2]; char temp[2];