diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-06 09:29:32 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-06 09:29:32 +0200 |
| commit | 2af1da4ff46915256ff30a4f54f6ad0a41804aee (patch) | |
| tree | 9dd1397b08450615ece81d1b7db3db739c9a901b /libdecor | |
| parent | 53543acb2e668c9efeab8305ba1bb69a9c661787 (diff) | |
Wayland: simpler implementation of "GTK Shell" protocol
Diffstat (limited to 'libdecor')
| -rw-r--r-- | libdecor/build/fl_libdecor-plugins.c | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/libdecor/build/fl_libdecor-plugins.c b/libdecor/build/fl_libdecor-plugins.c index f04f8cf2c..4197ea8f0 100644 --- a/libdecor/build/fl_libdecor-plugins.c +++ b/libdecor/build/fl_libdecor-plugins.c @@ -301,52 +301,11 @@ unsigned char *fl_libdecor_titlebar_buffer(struct libdecor_frame *frame, } -struct libdecor { // copied from libdecor.c, for libdecor versions > 0.2.2 - int ref_count; - const struct libdecor_interface *iface; - void *user_data; // added after libdecor version 0.2.2 - struct libdecor_plugin *plugin; - bool plugin_ready; - struct wl_display *wl_display; - struct wl_registry *wl_registry; - struct xdg_wm_base *xdg_wm_base; - struct zxdg_decoration_manager_v1 *decoration_manager; - struct wl_callback *init_callback; - bool init_done; - bool has_error; - struct wl_list frames; -}; - -struct libdecor_022 { // for libdecor versions ≤ 0.2.2 - int ref_count; - const struct libdecor_interface *iface; - struct libdecor_plugin *plugin; - bool plugin_ready; - struct wl_display *wl_display; - struct wl_registry *wl_registry; - struct xdg_wm_base *xdg_wm_base; - struct zxdg_decoration_manager_v1 *decoration_manager; - struct wl_callback *init_callback; - bool init_done; - bool has_error; - struct wl_list frames; -}; - - -/* Returns whether surface is a GTK-titlebar created by libdecor-gtk */ -bool fl_is_surface_gtk_titlebar(struct wl_surface *surface, struct libdecor *context, - struct wl_display *wl_display) { - if (!context || get_plugin_kind(NULL) != GTK3) return false; - // loop over all decorations created by libdecor-gtk - struct libdecor_frame *frame; - struct wl_list *frames; - if (context->wl_display == wl_display) frames = &context->frames; - else if (((struct libdecor_022*)context)->wl_display == wl_display) - frames = &(((struct libdecor_022*)context)->frames); - else return false; - wl_list_for_each(frame, frames, link) { - struct libdecor_frame_gtk *frame_gtk = (struct libdecor_frame_gtk*)frame; - if (frame_gtk->headerbar.wl_surface == surface) return true; - } - return false; +/* Returns whether surface is the libdecor-created GTK-titlebar of frame */ +bool fl_is_surface_from_GTK_titlebar (struct wl_surface *surface, struct libdecor_frame *frame, + bool *using_GTK) { + *using_GTK = (get_plugin_kind(NULL) == GTK3); + if (!*using_GTK) return false; + struct libdecor_frame_gtk *frame_gtk = (struct libdecor_frame_gtk*)frame; + return (frame_gtk->headerbar.wl_surface == surface); } |
