summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-17 10:40:09 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-17 10:40:09 +0200
commitf01216f167bad1ad2efff1c351c9d310ef1104a2 (patch)
tree69f3ff597553cd4ec16b69225fcd6fe82d10dfa6 /src
parentb2bd12ae5e43386761e1251e57bbe6336f7c5125 (diff)
Weston support: handle click on titlebar.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx10
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx11
2 files changed, 13 insertions, 8 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 7b4b34116..27512a43e 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -227,10 +227,12 @@ struct wl_display *Fl_Wayland_Screen_Driver::wl_display = NULL;
Fl_Window *Fl_Wayland_Screen_Driver::surface_to_window(struct wl_surface *surface) {
- Fl_X *xp = Fl_X::first;
- while (xp) {
- if (xp->xid->wl_surface == surface) return xp->w;
- xp = xp->next;
+ if (surface) {
+ Fl_X *xp = Fl_X::first;
+ while (xp) {
+ if (xp->xid->wl_surface == surface) return xp->w;
+ xp = xp->next;
+ }
}
return NULL;
}
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 587b15668..934cb4de6 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -790,10 +790,12 @@ static void handle_configure(struct libdecor_frame *frame,
"There is no way to know if the surface is currently minimized, nor is there any way to
unset minimization on this surface. If you are looking to throttle redrawing when minimized,
please instead use the wl_surface.frame event" */
- if (window_state == LIBDECOR_WINDOW_STATE_NONE) {
- Fl::handle(FL_UNFOCUS, window->fl_win);
- }
- else if (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) {
+ if (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) {
+ if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::WESTON) {
+ // After click on titlebar, weston calls wl_keyboard_enter() for a
+ // titlebar-related surface that FLTK can't identify, so we send FL_FOCUS here.
+ Fl::handle(FL_FOCUS, window->fl_win);
+ }
if (!window->fl_win->border()) libdecor_frame_set_visibility(window->frame, false);
else if (!libdecor_frame_is_visible(window->frame)) libdecor_frame_set_visibility(window->frame, true);
}
@@ -833,6 +835,7 @@ void Fl_Wayland_Window_Driver::wait_for_expose()
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
}
} else if (xid->kind == DECORATED) {
+ // necessary for the windowfocus demo program with recent Wayland versions
if (!(xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) {
wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
}