This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch main
in repository widgets.
View the commit online.
commit 31bdc0237e1442e20627918fcfcec06f048a4c34
Author: Alastair Poole <[email protected]>
AuthorDate: Tue Dec 1 02:42:31 2026 +0000
e_mod_main: add wayland support
---
README.md | 2 +-
e_mod_main.c | 62 +++++++++++++++++++++++++++++++++----------------
modules/sports/sports.c | 1 +
3 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index 03b10e1..1fcd20f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Widgets
-Widgets is an Enlightenment module with these gadgets.
+Widgets is an Enlightenment module for X11 and Wayland sessions with these gadgets.
- Battery
- Clock
diff --git a/e_mod_main.c b/e_mod_main.c
index c3bdcda..baabdcb 100644
--- a/e_mod_main.c
+++ b/e_mod_main.c
@@ -85,7 +85,7 @@ widgets_shape_update(void *data)
static void
widgets_shape_queue(Widgets *state)
{
- if (!state->shape_job)
+ if (state->xid && !state->shape_job)
state->shape_job = ecore_job_add(widgets_shape_update, state);
}
@@ -137,9 +137,17 @@ widgets_card_menu(void *data, Evas *evas, Evas_Object *card EINA_UNUSED, void *e
if (mouse->button != 3 || state->menu) return;
- ecore_x_pointer_xy_get(e_comp->root, &x, &y);
- x = e_comp_canvas_x_root_adjust(x);
- y = e_comp_canvas_y_root_adjust(y);
+ if (evas == e_comp->evas)
+ {
+ x = mouse->canvas.x;
+ y = mouse->canvas.y;
+ }
+ else
+ {
+ ecore_x_pointer_xy_get(e_comp->root, &x, &y);
+ x = e_comp_canvas_x_root_adjust(x);
+ y = e_comp_canvas_y_root_adjust(y);
+ }
zone = e_comp_zone_xy_get(x, y);
if (!zone) return;
@@ -324,7 +332,7 @@ widgets_desktop_resize(void *data, int type EINA_UNUSED, void *event EINA_UNUSED
int x, y;
state = data;
- client = e_win_client_get(state->desktop);
+ client = state->xid ? e_win_client_get(state->desktop) : NULL;
if (client && (client->client.x || client->client.y))
e_client_util_move_without_frame(client, 0, 0);
evas_object_resize(state->desktop, e_comp->w, e_comp->h);
@@ -339,10 +347,8 @@ widgets_desktop_resize(void *data, int type EINA_UNUSED, void *event EINA_UNUSED
}
static Eina_Bool
-widgets_desktop_add(Widgets *state)
+widgets_desktop_x11_add(Widgets *state)
{
- Evas *canvas;
-
state->desktop = elm_win_add(NULL, "widgets-desktop", ELM_WIN_BASIC);
if (!state->desktop) return EINA_FALSE;
@@ -361,23 +367,44 @@ widgets_desktop_add(Widgets *state)
ecore_x_netwm_window_type_set(state->xid, ECORE_X_WINDOW_TYPE_DESKTOP);
ecore_x_netwm_window_state_set(state->xid, widgets_desktop_hints,
EINA_C_ARRAY_LENGTH(widgets_desktop_hints));
- canvas = evas_object_evas_get(state->desktop);
- state->bounds = evas_object_rectangle_add(canvas);
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+widgets_desktop_add(Widgets *state)
+{
+ if (e_comp->comp_type == E_PIXMAP_TYPE_X)
+ {
+ if (!widgets_desktop_x11_add(state)) return EINA_FALSE;
+ }
+ else
+ {
+ /* Scope the gadget theme on the compositor canvas. */
+ state->desktop = elm_box_add(e_comp->elm);
+ if (!state->desktop) return EINA_FALSE;
+ elm_object_theme_set(state->desktop, state->theme);
+ evas_object_pass_events_set(state->desktop, EINA_TRUE);
+ }
+
+ state->bounds = evas_object_rectangle_add(evas_object_evas_get(state->desktop));
if (!state->bounds) return EINA_FALSE;
evas_object_pass_events_set(state->bounds, EINA_TRUE);
evas_object_move(state->desktop, 0, 0);
widgets_desktop_resize(state, 0, NULL);
- if (state->shape_job) ecore_job_del(state->shape_job);
- widgets_shape_update(state);
+ if (state->xid)
+ {
+ if (state->shape_job) ecore_job_del(state->shape_job);
+ widgets_shape_update(state);
+ state->shape_hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_END,
+ widgets_compositor_input, state);
+ }
state->display_handlers[0] = ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
widgets_desktop_resize, state);
state->display_handlers[1] = ecore_event_handler_add(E_EVENT_ZONE_ADD,
widgets_desktop_resize, state);
state->display_handlers[2] = ecore_event_handler_add(E_EVENT_ZONE_DEL,
widgets_desktop_resize, state);
- state->shape_hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_END,
- widgets_compositor_input, state);
evas_object_show(state->desktop);
return EINA_TRUE;
}
@@ -485,12 +512,6 @@ e_modapi_init(E_Module *module)
Widgets *state;
char *directory;
- if (e_comp->comp_type != E_PIXMAP_TYPE_X)
- {
- e_module_dialog_show(module, "Widgets", "Widgets requires an X11 Enlightenment session.");
- return NULL;
- }
-
state = calloc(1, sizeof(*state));
if (!state) return NULL;
widgets = state;
@@ -556,6 +577,7 @@ e_modapi_shutdown(E_Module *module EINA_UNUSED)
widgets_gadgets_free(state);
elements_places_shutdown();
+ evas_object_del(state->bounds);
evas_object_del(state->desktop);
if (state->shape_job) ecore_job_del(state->shape_job);
elm_theme_free(state->theme);
diff --git a/modules/sports/sports.c b/modules/sports/sports.c
index 782b9e9..4794e44 100644
--- a/modules/sports/sports.c
+++ b/modules/sports/sports.c
@@ -584,6 +584,7 @@ widgets_sports_new(Evas_Object *window, Evas_Object *bounds, GKeyFile *settings,
/* Hoversels take the hover parent's layer and use its geometry as their bounds. */
sports->hover_parent = elm_box_add(window);
evas_object_layer_set(sports->hover_parent, 2);
+ evas_object_pass_events_set(sports->hover_parent, EINA_TRUE);
evas_object_show(sports->hover_parent);
sports->country = elm_hoversel_add(window);
widgets_picker_register(sports->country);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.