summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx29
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())