diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-12-22 00:12:48 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2025-12-22 00:12:48 +0100 |
| commit | 525db6ddca5dd11d29cf122fb77fd9210bfdab2d (patch) | |
| tree | 49cf8e8a369f8d1ad749bf499ffbb3f6fb97be20 /src/drivers | |
| parent | e4fbf3e6ee8bb6edac8f0e526a37d4c1376f40b0 (diff) | |
Wayland: fixes syntax errors
This code generates a lot of
extra events
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 8e0aed785..96fab22e2 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -974,13 +974,14 @@ static void handle_configure(struct libdecor_frame *frame, //fprintf(stderr, "handle_configure fl_win=%p size:%dx%d state=%x wait_for_expose_value=%d is_2nd_run=%d\n", window->fl_win, width,height,window_state,driver->wait_for_expose_value, is_2nd_run); // Generate FL_APP_ACTIVATE and FL_APP_DEACTIVATE events - static bool app_has_actuve_window = false; + static bool app_has_active_window = false; + // When no window is active, and one window gets activated, generate an FL_APP_ACTIVATE event if (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) { - // When a window gets first activated, generate an FL_APP_ACTIVATE event - bool app_was_active = app_has_active_window; - app_has_active_window = true; - if (!app_was_active) Fl::handle(FL_APP_ACTIVATE); + if (!app_has_active_window) { + app_has_active_window = true; + Fl::handle(FL_APP_ACTIVATE, nullptr); + } if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::WESTON) { // After click on titlebar, weston calls wl_keyboard_enter() for a @@ -999,21 +1000,19 @@ static void handle_configure(struct libdecor_frame *frame, // When a window gets deactivated and there are no other active windows, // generate an FL_APP_DEACTIVATE event - if ((window_state & LIBDECOR_WINDOW_STATE_ACTIVE) == 0) { - bool app_was_active = app_has_active_window; + if ( ((window_state & LIBDECOR_WINDOW_STATE_ACTIVE) == 0) && app_has_active_window) { app_has_active_window = false; // Check all FLTK windows to see if any are still active for (Fl_Window *w = Fl::first_window(); w; w = Fl::next_window(w)) { - if (w != window->fl_win && w->shown()) { - Fl_Wayland_Window_Driver *wd = Fl_Wayland_Window_Driver::driver(w); - struct wld_window* xid = fl_wl_xid(wd->pWindow); - if (xid && (xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) { - app_has_active_window = true; - break; - } + if (w != window->fl_win && w->shown()) { + struct wld_window* xid = fl_wl_xid(w); + if (xid && (xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) { + app_has_active_window = true; + break; } + } } - if (app_was_active && !app_has_active_window) Fl::handle(FL_APP_DEACTIVATE); + if (!app_has_active_window) Fl::handle(FL_APP_DEACTIVATE, nullptr); } if (window->fl_win->border()) |
