Skip to content

Commit

Permalink
Clarify dragging flags
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov committed Jul 20, 2023
1 parent b07a7bc commit 50d7c71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/window_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions src/window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/window_manager_private.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -885,7 +885,7 @@ int _win_debug(char* string)
NULL,
NULL,
NULL,
BUTTON_FLAG_0x10);
BUTTON_DRAG_HANDLE);
}

char temp[2];
Expand Down

0 comments on commit 50d7c71

Please sign in to comment.