From 12d7405a0fa1c82d6d86d84e2783af212e22f0b1 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 11 Sep 2013 14:23:43 +0100 Subject: [PATCH] huge wl fixup (wayland clients actually working again) * try to clear up build system for separating out ecore-x * add #ifdefs for lots of ecore-x stuff * break out some internal e wl functions for reuse in api * store wl surface buffers as an inlist * add protocol-specific client compositor data ** move lots of X client attributes here * add pixmap type checks to a number of X-specific things, such as grabinput, to block them for non-X clients * rearrange startup order to work with wayland * move X screensaver code to e_comp_x * flag modules still requiring X with -DNEED_X --- src/bin/Makefile.mk | 19 +- src/bin/e.h | 3 - src/bin/e_actions.c | 3 +- src/bin/e_canvas.c | 37 +++- src/bin/e_canvas.h | 2 +- src/bin/e_client.h | 74 ++----- src/bin/e_comp.c | 3 +- src/bin/e_comp.h | 3 +- src/bin/e_comp_cfdata.c | 2 - src/bin/e_comp_cfdata.h | 1 - src/bin/e_comp_wl.c | 195 +++++++++--------- src/bin/e_comp_wl.h | 31 ++- src/bin/e_comp_x.c | 240 +++++++++++++--------- src/bin/e_comp_x.h | 106 +++++++++- src/bin/e_dnd.c | 6 +- src/bin/e_dnd.h | 10 +- src/bin/e_gadcon.c | 2 +- src/bin/e_grabinput.c | 3 + src/bin/e_hints.c | 33 ++- src/bin/e_includes.h | 6 +- src/bin/e_int_client_menu.c | 2 +- src/bin/e_int_client_menu.h | 2 +- src/bin/e_int_client_prop.c | 6 +- src/bin/e_int_config_comp_match.c | 34 +-- src/bin/e_main.c | 32 ++- src/bin/e_manager.c | 6 +- src/bin/e_menu.c | 14 +- src/bin/e_menu.h | 4 +- src/bin/e_pixmap.c | 71 ++++--- src/bin/e_pixmap.h | 2 +- src/bin/e_pointer.c | 2 + src/bin/e_screensaver.c | 118 ++--------- src/bin/e_screensaver.h | 3 +- src/bin/e_win.c | 36 +++- src/bin/e_win.h | 2 +- src/modules/Makefile_conf_bindings.mk | 2 +- src/modules/Makefile_conf_display.mk | 2 +- src/modules/Makefile_conf_randr.mk | 2 +- src/modules/Makefile_conf_theme.mk | 2 +- src/modules/Makefile_everything.mk | 2 +- src/modules/Makefile_fileman.mk | 2 +- src/modules/Makefile_pager.mk | 2 +- src/modules/Makefile_shot.mk | 2 +- src/modules/Makefile_systray.mk | 7 +- src/modules/Makefile_tiling.mk | 2 +- src/modules/Makefile_winlist.mk | 2 +- src/modules/Makefile_wizard.mk | 2 +- src/modules/Makefile_xkbswitch.mk | 2 +- src/modules/contact/e_policy.c | 3 +- src/modules/wl_desktop_shell/e_mod_main.c | 205 +++++++++--------- 50 files changed, 720 insertions(+), 632 deletions(-) diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 9fe961b00..99553827b 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -210,7 +210,6 @@ endif enlightenment_src = \ src/bin/e_about.c \ src/bin/e_acpi.c \ -src/bin/e_alert.c \ src/bin/e_actions.c \ src/bin/e_atoms.c \ src/bin/e_backlight.c \ @@ -226,7 +225,6 @@ src/bin/e_comp.c \ src/bin/e_comp_canvas.c \ src/bin/e_comp_cfdata.c \ src/bin/e_comp_object.c \ -src/bin/e_comp_x.c \ src/bin/e_config.c \ src/bin/e_config_data.c \ src/bin/e_config_dialog.c \ @@ -307,7 +305,6 @@ src/bin/e_place.c \ src/bin/e_pointer.c \ src/bin/e_powersave.c \ src/bin/e_prefix.c \ -src/bin/e_randr.c \ src/bin/e_remember.c \ src/bin/e_resist.c \ src/bin/e_scale.c \ @@ -362,25 +359,31 @@ src/bin/e_widget_toolbar.c \ src/bin/e_widget_toolbook.c \ src/bin/e_win.c \ src/bin/e_xinerama.c \ -src/bin/e_xkb.c \ -src/bin/e_xsettings.c \ src/bin/e_zoomap.c \ src/bin/e_zone.c \ $(ENLIGHTENMENTHEADERS) +if ! HAVE_WAYLAND_ONLY +enlightenment_src += \ +src/bin/e_alert.c \ +src/bin/e_comp_x.c \ +src/bin/e_randr.c \ +src/bin/e_xkb.c \ +src/bin/e_xsettings.c +endif + if HAVE_WAYLAND_CLIENTS enlightenment_src += \ src/bin/e_comp_wl.c endif -src_bin_enlightenment_CFLAGS = $(AM_CPPFLAGS) @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@ -src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DE_LOGGING=1 +src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DE_LOGGING=1 @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@ @ECORE_X_CFLAGS@ -DNEED_X=1 src_bin_enlightenment_SOURCES = \ src/bin/e_main.c \ $(enlightenment_src) src_bin_enlightenment_LDFLAGS = -export-dynamic -src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ @WAYLAND_EGL_LIBS@ -lm +src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ @WAYLAND_EGL_LIBS@ -lm @ECORE_X_LIBS@ src_bin_enlightenment_imc_SOURCES = \ src/bin/e.h \ diff --git a/src/bin/e.h b/src/bin/e.h index 82ee24414..538649d68 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -105,7 +105,6 @@ void *alloca (size_t); # include # include # include -# include # include # include # include @@ -311,8 +310,6 @@ extern EAPI Eina_Bool x_fatal; extern EINTERN const char *e_first_frame; extern EINTERN double e_first_frame_start_time; -EAPI void e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window win); - //#define SMARTERR(args...) abort() #define SMARTERRNR() return #define SMARTERR(x) return x diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 4c93c702b..b70065fa1 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -1854,8 +1854,7 @@ ACT_FN_GO(menu_show, ) ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y); e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); e_menu_activate_mouse(m, zone, x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, - ecore_x_current_time_get()); + E_MENU_POP_DIRECTION_DOWN, 0); } } } diff --git a/src/bin/e_canvas.c b/src/bin/e_canvas.c index 14a4bee5c..03fc3a5d2 100644 --- a/src/bin/e_canvas.c +++ b/src/bin/e_canvas.c @@ -143,19 +143,44 @@ e_canvas_rehint(void) } EAPI Ecore_Evas * -e_canvas_new(Ecore_X_Window win, int x, int y, int w, int h, - int direct_resize, int override, Ecore_X_Window *win_ret) +e_canvas_new(Ecore_Window win, int x, int y, int w, int h, + int direct_resize, int override, Ecore_Window *win_ret) { Ecore_Evas *ee = NULL; - ee = ecore_evas_software_x11_new(NULL, win, x, y, w, h); +#ifdef WAYLAND_ONLY + ee = ecore_evas_wayland_shm_new(NULL, win, x, y, w, h, 0); if (ee) { ecore_evas_override_set(ee, override); - if (direct_resize) ecore_evas_software_x11_direct_resize_set(ee, 1); - if (win_ret) *win_ret = ecore_evas_software_x11_window_get(ee); + if (win_ret) *win_ret = ecore_evas_wayland_window_get(ee); } - else +#else + switch (e_comp_get(NULL)->comp_type) + { + case E_PIXMAP_TYPE_X: + ee = ecore_evas_software_x11_new(NULL, win, x, y, w, h); + if (ee) + { + ecore_evas_override_set(ee, override); + if (direct_resize) ecore_evas_software_x11_direct_resize_set(ee, 1); + if (win_ret) *win_ret = ecore_evas_software_x11_window_get(ee); + } + break; +# ifdef HAVE_WAYLAND_CLIENTS + case E_PIXMAP_TYPE_WL: + ee = ecore_evas_wayland_shm_new(NULL, win, x, y, w, h, 0); + if (ee) + { + ecore_evas_override_set(ee, override); + if (win_ret) *win_ret = (Ecore_Window)ecore_evas_wayland_window_get(ee); + } + break; +# endif + default: break; + } +#endif + if (!ee) EINA_LOG_ERR("Impossible to build any Ecore_Evas window !!"); return ee; } diff --git a/src/bin/e_canvas.h b/src/bin/e_canvas.h index 59050c23b..895ee47ce 100644 --- a/src/bin/e_canvas.h +++ b/src/bin/e_canvas.h @@ -10,7 +10,7 @@ EAPI void e_canvas_cache_flush(void); EAPI void e_canvas_cache_reload(void); EAPI void e_canvas_idle_flush(void); EAPI void e_canvas_rehint(void); -EAPI Ecore_Evas *e_canvas_new(Ecore_X_Window win, int x, int y, int w, int h, int direct_resize, int override, Ecore_X_Window *win_ret); +EAPI Ecore_Evas *e_canvas_new(Ecore_Window win, int x, int y, int w, int h, int direct_resize, int override, Ecore_Window *win_ret); EAPI const Eina_List *e_canvas_list(void); #endif diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 7fc2c8ded..f73b6771a 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -244,7 +244,7 @@ struct E_Client E_Direction shade_dir; - E_Comp_Client_Data *comp_data; //private for the compositor engine (X, Wayland) ONLY + E_Comp_Client_Data *comp_data; //private for the compositor engine (X, Wayland) ONLY Evas_Object *input_object; //for running wayland clients in X @@ -322,15 +322,17 @@ struct E_Client int step_w, step_h; int start_x, start_y; double min_aspect, max_aspect; + Ecore_Window icon_window; + Ecore_Window window_group; + Ecore_Window transient_for; + Ecore_Window client_leader; +#ifdef E_COMP_X_H Ecore_X_Window_State_Hint initial_state; Ecore_X_Window_State_Hint state; Ecore_X_Pixmap icon_pixmap; Ecore_X_Pixmap icon_mask; - Ecore_X_Window icon_window; - Ecore_X_Window window_group; - Ecore_X_Window transient_for; - Ecore_X_Window client_leader; Ecore_X_Gravity gravity; +#endif Eina_Stringshare *window_role; unsigned char take_focus : 1; unsigned char accepts_focus : 1; @@ -362,9 +364,11 @@ struct E_Client /* MWM */ struct { +#ifdef E_COMP_X_H Ecore_X_MWM_Hint_Func func; Ecore_X_MWM_Hint_Decor decor; Ecore_X_MWM_Hint_Input input; +#endif unsigned char exists : 1; unsigned char borderless : 1; struct @@ -380,7 +384,9 @@ struct E_Client unsigned int desktop; Eina_Stringshare *name; Eina_Stringshare *icon_name; +#ifdef E_COMP_X_H Ecore_X_Icon *icons; +#endif int num_icons; unsigned int user_time; unsigned char opacity; @@ -404,9 +410,8 @@ struct E_Client struct { unsigned char request : 1; + unsigned char alarm : 1; unsigned int wait; - Ecore_X_Sync_Alarm alarm; - Ecore_X_Sync_Counter counter; unsigned int serial; double send_time; } sync; @@ -440,7 +445,6 @@ struct E_Client unsigned char change_desktop : 1; unsigned char close : 1; } action; - E_Window_Type type; E_Window_Type *extra_types; int extra_types_num; @@ -525,63 +529,13 @@ struct E_Client unsigned char state : 1; unsigned char vkbd : 1; } fetch; +#ifdef E_COMP_X_H Ecore_X_Virtual_Keyboard_State state; +#endif unsigned char have_property : 1; unsigned char vkbd : 1; } vkbd; - struct - { - struct - { - struct - { - unsigned char conformant : 1; - } fetch; - unsigned char conformant : 1; - } conformant; - struct - { - struct - { - unsigned char state : 1; - struct - { - unsigned int major : 1; - unsigned int minor : 1; - } priority; - unsigned char quickpanel : 1; - unsigned char zone : 1; - } fetch; - Ecore_X_Illume_Quickpanel_State state; - struct - { - unsigned int major : 1; - unsigned int minor : 1; - } priority; - unsigned char quickpanel : 1; - int zone; - } quickpanel; - struct - { - struct - { - unsigned char drag : 1; - unsigned char locked : 1; - } fetch; - unsigned char drag : 1; - unsigned char locked : 1; - } drag; - struct - { - struct - { - unsigned char state : 1; - } fetch; - Ecore_X_Illume_Window_State state; - } win_state; - } illume; - struct { unsigned char visible : 1; diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index afe3310cd..c494372f8 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -3,8 +3,6 @@ #include "e_comp_wl.h" #endif -#include "e_comp_x.h" - #define ACTION_TIMEOUT 30.0 #define OVER_FLOW 1 //#define SHAPE_DEBUG @@ -1369,6 +1367,7 @@ e_comp_shape_queue(E_Comp *c) { EINA_SAFETY_ON_NULL_RETURN(c); + if (c->comp_type != E_PIXMAP_TYPE_X) return; if (!c->shape_job) c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c); } diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h index 0b0648aeb..5e84e76eb 100644 --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@ -1,7 +1,7 @@ #ifdef E_TYPEDEFS typedef struct _E_Comp E_Comp; typedef struct _E_Comp_Data E_Comp_Data; -typedef struct E_Comp_Client_Data E_Comp_Client_Data; +typedef struct _E_Comp_Client_Data E_Comp_Client_Data; typedef struct _E_Comp_Demo_Style_Item E_Comp_Demo_Style_Item; #define E_COMP_TYPE (int) 0xE0b01003 @@ -55,6 +55,7 @@ struct _E_Comp unsigned int new_clients; E_Comp_Data *comp_data; + E_Pixmap_Type comp_type; //for determining X/Wayland/ unsigned int num; Eina_Stringshare *name; diff --git a/src/bin/e_comp_cfdata.c b/src/bin/e_comp_cfdata.c index 4b3cf1319..79b371791 100644 --- a/src/bin/e_comp_cfdata.c +++ b/src/bin/e_comp_cfdata.c @@ -17,8 +17,6 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd) E_CONFIG_VAL(D, T, borderless, CHAR); E_CONFIG_VAL(D, T, dialog, CHAR); E_CONFIG_VAL(D, T, accepts_focus, CHAR); - E_CONFIG_VAL(D, T, vkbd, CHAR); - E_CONFIG_VAL(D, T, quickpanel, CHAR); E_CONFIG_VAL(D, T, argb, CHAR); E_CONFIG_VAL(D, T, fullscreen, CHAR); E_CONFIG_VAL(D, T, modal, CHAR); diff --git a/src/bin/e_comp_cfdata.h b/src/bin/e_comp_cfdata.h index 274485958..fc8439207 100644 --- a/src/bin/e_comp_cfdata.h +++ b/src/bin/e_comp_cfdata.h @@ -67,7 +67,6 @@ struct _E_Comp_Match char dialog; // used for borders, 0 == don't use, 1 == dialog, -1 == not dialog char accepts_focus; // used for borders, 0 == don't use, 1 == accepts focus, -1 == does not accept focus char vkbd; // used for borders, 0 == don't use, 1 == is vkbd, -1 == not vkbd - char quickpanel; // used for borders, 0 == don't use, 1 == is quickpanel, -1 == not quickpanel char argb; // used for borders, overrides, popups, menus, 0 == don't use, 1 == is argb, -1 == not argb char fullscreen; // used for borders, 0 == don't use, 1 == is fullscreen, -1 == not fullscreen char modal; // used for borders, 0 == don't use, 1 == is modal, -1 == not modal diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 159254b99..f59f23891 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -2,6 +2,8 @@ #include "e_comp_wl.h" #include +#define e_pixmap_parent_window_set(X, Y) e_pixmap_parent_window_set(X, (Ecore_Window)(uintptr_t)Y) + /* compositor function prototypes */ static void _seat_send_updated_caps(struct wl_seat *seat); static void _move_resources(struct wl_list *dest, struct wl_list *src); @@ -58,7 +60,6 @@ static void _e_comp_wl_cb_bind(struct wl_client *client, void *data, unsigned in static Eina_Bool _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdl EINA_UNUSED); static Eina_Bool _e_comp_wl_cb_idle(void *data EINA_UNUSED); static Eina_Bool _e_comp_wl_cb_module_idle(void *data EINA_UNUSED); -static Eina_Bool _e_comp_wl_cb_keymap_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED); /* compositor interface prototypes */ static void _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resource, unsigned int id); @@ -228,7 +229,7 @@ static Ecore_Idler *_module_idler = NULL; EAPI E_Wayland_Compositor *_e_wl_comp; /* external functions */ -EINTERN Eina_Bool +EAPI Eina_Bool e_comp_wl_init(void) { int fd = 0; @@ -271,7 +272,7 @@ e_comp_wl_init(void) * NB: This is interesting....if we try to eglGetDisplay and pass in the * wayland display, then EGL fails due to XCB not owning the event queue. * If we pass it a NULL, it inits just fine */ - _e_wl_comp->egl.display = eglGetDisplay((EGLNativeDisplayType)ecore_x_display_get()); + _e_wl_comp->egl.display = eglGetDisplay(NULL); if (_e_wl_comp->egl.display == EGL_NO_DISPLAY) ERR("Could not get EGL display: %m"); else @@ -302,44 +303,6 @@ e_comp_wl_init(void) ERR("Could not choose EGL config: %m"); eglTerminate(_e_wl_comp->egl.display); } - - /* if (!eglBindAPI(EGL_OPENGL_ES_API)) */ - /* { */ - /* ERR("Could not bind EGL API: %m"); */ - /* eglTerminate(_e_wl_comp->egl.display); */ - /* } */ - - /* exts = (const char *)eglQueryString(_e_wl_comp->egl.display, EGL_EXTENSIONS); */ - /* if (!exts) */ - /* { */ - /* ERR("Could not get EGL Extensions: %m"); */ - /* eglTerminate(_e_wl_comp->egl.display); */ - /* } */ - /* else */ - /* { */ - /* if (strstr(exts, "EGL_WL_bind_wayland_display")) */ - /* { */ - /* _e_wl_comp->egl.bind_display = */ - /* (void *)eglGetProcAddress("eglBindWaylandDisplayWL"); */ - /* _e_wl_comp->egl.unbind_display = */ - /* (void *)eglGetProcAddress("eglUnbindWaylandDisplayWL"); */ - /* } */ - /* } */ - - /* if (_e_wl_comp->egl.bind_display) */ - /* { */ - /* EGLBoolean ret; */ - - /* ret = _e_wl_comp->egl.bind_display(_e_wl_comp->egl.display, */ - /* _e_wl_comp->wl.display); */ - /* if (!ret) */ - /* { */ - /* ERR("Could not bind EGL Wayland Display: %m"); */ - /* _e_wl_comp->egl.bound = EINA_FALSE; */ - /* } */ - /* else */ - /* _e_wl_comp->egl.bound = EINA_TRUE; */ - /* } */ } } #endif @@ -351,11 +314,12 @@ e_comp_wl_init(void) goto err; } +#ifndef WAYLAND_ONLY /* setup keymap_change event handler */ _e_wl_comp->kbd_handler = ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, - _e_comp_wl_cb_keymap_changed, NULL); - + e_comp_wl_cb_keymap_changed, NULL); +#endif /* get the displays event loop */ _e_wl_comp->wl.loop = wl_display_get_event_loop(_e_wl_comp->wl.display); @@ -379,9 +343,11 @@ e_comp_wl_init(void) goto err; } + wl_event_loop_dispatch(_e_wl_comp->wl.loop, 0); +#ifndef WAYLAND_ONLY /* add an idler for deferred shell module loading */ _module_idler = ecore_idler_add(_e_comp_wl_cb_module_idle, NULL); - +#endif /* return success */ return EINA_TRUE; @@ -389,9 +355,10 @@ err: /* remove kbd handler */ if (_e_wl_comp->kbd_handler) ecore_event_handler_del(_e_wl_comp->kbd_handler); - +#ifndef WAYLAND_ONLY /* remove the module idler */ if (_module_idler) ecore_idler_del(_module_idler); +#endif #ifdef HAVE_WAYLAND_EGL /* unbind wayland display */ @@ -456,6 +423,17 @@ e_comp_wl_shutdown(void) e_module_disable(mod); } +#ifdef WAYLAND_ONLY +EAPI int +e_comp_wl_input_read(int fd EINA_UNUSED, unsigned int mask EINA_UNUSED, void *data) +{ + E_Wayland_Compositor *wl_comp = data; + + wl_event_loop_dispatch(wl_comp->wl.input_loop, 0); + return 1; +} +#endif + EAPI void wl_seat_init(struct wl_seat *seat) { @@ -845,6 +823,44 @@ e_comp_wl_time_get(void) return (tm.tv_sec * 1000 + tm.tv_usec / 1000); } +EAPI void +e_comp_wl_mouse_button(struct wl_resource *resource, uint32_t serial, uint32_t timestamp, uint32_t button, uint32_t state_w) +{ + switch (button) + { + case BTN_LEFT: + case BTN_MIDDLE: + case BTN_RIGHT: + wl_pointer_send_button(resource, serial, timestamp, + button, state_w); + break; + case 4: + if (state_w) + wl_pointer_send_axis(resource, timestamp, + WL_POINTER_AXIS_VERTICAL_SCROLL, + -wl_fixed_from_int(1)); + break; + case 5: + if (state_w) + wl_pointer_send_axis(resource, timestamp, + WL_POINTER_AXIS_VERTICAL_SCROLL, + wl_fixed_from_int(1)); + break; + case 6: + if (state_w) + wl_pointer_send_axis(resource, timestamp, + WL_POINTER_AXIS_HORIZONTAL_SCROLL, + -wl_fixed_from_int(1)); + break; + case 7: + if (state_w) + wl_pointer_send_axis(resource, timestamp, + WL_POINTER_AXIS_HORIZONTAL_SCROLL, + wl_fixed_from_int(1)); + break; + } +} + EAPI void e_comp_wl_input_modifiers_update(unsigned int serial) { @@ -976,47 +992,8 @@ _default_grab_button(struct wl_pointer_grab *grab, uint32_t timestamp, uint32_t serial = wl_display_next_serial(_e_wl_comp->wl.display); wl_resource_for_each(res, lst) - { - switch (button) - { - case BTN_LEFT: - case BTN_MIDDLE: - case BTN_RIGHT: - wl_pointer_send_button(res, serial, timestamp, - button, state_w); - break; - case 4: - if (state_w) - wl_pointer_send_axis(res, timestamp, - WL_POINTER_AXIS_VERTICAL_SCROLL, - -wl_fixed_from_int(1)); - break; - case 5: - if (state_w) - wl_pointer_send_axis(res, timestamp, - WL_POINTER_AXIS_VERTICAL_SCROLL, - wl_fixed_from_int(1)); - break; - case 6: - if (state_w) - wl_pointer_send_axis(res, timestamp, - WL_POINTER_AXIS_HORIZONTAL_SCROLL, - -wl_fixed_from_int(1)); - break; - case 7: - if (state_w) - wl_pointer_send_axis(res, timestamp, - WL_POINTER_AXIS_HORIZONTAL_SCROLL, - wl_fixed_from_int(1)); - break; - } - } + e_comp_wl_mouse_button(res, serial, timestamp, button, state_w); } - - if (pointer->button_count == 0 && - state == WL_POINTER_BUTTON_STATE_RELEASED) - wl_pointer_set_focus(pointer, pointer->current, - pointer->current_x, pointer->current_y); } static void @@ -1573,8 +1550,8 @@ _e_comp_wl_cb_module_idle(void *data EINA_UNUSED) return ECORE_CALLBACK_RENEW; } -static Eina_Bool -_e_comp_wl_cb_keymap_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +EAPI Eina_Bool +e_comp_wl_cb_keymap_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { struct xkb_keymap *keymap; @@ -1645,6 +1622,8 @@ static void _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resource, unsigned int id) { E_Wayland_Surface *ews = NULL; + uint64_t wid; + pid_t pid; /* try to allocate space for a new surface */ if (!(ews = E_NEW(E_Wayland_Surface, 1))) @@ -1654,7 +1633,11 @@ _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resou } ews->wl.client = client; - ews->pixmap = e_pixmap_new(E_PIXMAP_TYPE_WL, ews); + wl_client_get_credentials(client, &pid, NULL, NULL); + wid = e_comp_wl_id_get(pid, id); + ews->pixmap = e_pixmap_find(E_PIXMAP_TYPE_WL, wid); + if (!ews->pixmap) + ews->pixmap = e_pixmap_new(E_PIXMAP_TYPE_WL, wid); e_pixmap_parent_window_set(ews->pixmap, ews); e_pixmap_usable_set(ews->pixmap, 1); /* initialize the destroy signal */ @@ -1702,6 +1685,8 @@ _e_comp_wl_cb_surface_destroy(struct wl_resource *resource) E_Wayland_Surface *ews = NULL; E_Wayland_Surface_Frame_Callback *cb = NULL, *ncb = NULL; struct wl_pointer *pointer; + Eina_Inlist *l; + E_Wayland_Buffer *buffer; /* try to get the surface from this resource */ if (!(ews = wl_resource_get_user_data(resource))) @@ -1752,6 +1737,11 @@ _e_comp_wl_cb_surface_destroy(struct wl_resource *resource) wl_list_for_each_safe(cb, ncb, &ews->wl.frames, wl.link) wl_resource_destroy(cb->wl.resource); + EINA_INLIST_FOREACH_SAFE(ews->buffers, l, buffer) + { + buffer->ews = NULL; + ews->buffers = eina_inlist_remove(ews->buffers, EINA_INLIST_GET(buffer)); + } e_pixmap_parent_window_set(ews->pixmap, NULL); e_pixmap_free(ews->pixmap); @@ -1982,6 +1972,7 @@ _e_comp_wl_input_keymap_get(void) names.layout = strdup(kbd_layout->name); } +#ifndef WAYLAND_ONLY /* if we are running under X11, try to get the xkb rule names atom */ if (getenv("DISPLAY")) { @@ -2006,7 +1997,7 @@ _e_comp_wl_input_keymap_get(void) if ((data) && (len > 0)) { - names.rules = strdup((const char *)data); + names.rules = (char*)data; data += strlen((const char *)data) + 1; if (!names.model) names.model = strdup((const char *)data); @@ -2015,6 +2006,7 @@ _e_comp_wl_input_keymap_get(void) names.layout = strdup((const char *)data); } } +#endif printf("Keymap\n"); printf("\tRules: %s\n", names.rules); @@ -2552,7 +2544,7 @@ _e_comp_wl_surface_buffer_reference(E_Wayland_Buffer_Reference *ref, E_Wayland_B wl_signal_add(&buffer->wl.destroy_signal, &ref->destroy_listener); } - //INF("CURRENT BUFFER SWAP"); + //INF("CURRENT BUFFER SWAP: %p->%p", ref->buffer, buffer); ref->buffer = buffer; ref->destroy_listener.notify = _e_comp_wl_surface_buffer_reference_cb_destroy; @@ -2603,12 +2595,14 @@ _e_comp_wl_surface_buffer_cb_destroy(struct wl_listener *listener, void *data) E_Wayland_Buffer *buffer; buffer = container_of(listener, E_Wayland_Buffer, wl.destroy_listener); + wl_signal_emit(&buffer->wl.destroy_signal, buffer); - if (buffer->ews && buffer->ews->pixmap && (e_pixmap_resource_get(buffer->ews->pixmap) == data)) + if (buffer->ews) { - if (buffer->ews->ec) + if (buffer->ews->ec && buffer->ews->pixmap && (e_pixmap_resource_get(buffer->ews->pixmap) == data) && + evas_object_visible_get(buffer->ews->ec->frame)) { - INF("DESTROYED CURRENT BUFFER: %s", e_pixmap_dirty_get(buffer->ews->pixmap) ? "DIRTY" : "CLEAN"); + //INF("DESTROYED CURRENT BUFFER: %s", e_pixmap_dirty_get(buffer->ews->pixmap) ? "DIRTY" : "CLEAN"); e_pixmap_usable_set(buffer->ews->pixmap, 0); if (!e_pixmap_image_exists(buffer->ews->pixmap)) { @@ -2620,6 +2614,7 @@ _e_comp_wl_surface_buffer_cb_destroy(struct wl_listener *listener, void *data) e_comp_object_render(buffer->ews->ec->frame); e_comp_object_render_update_del(buffer->ews->ec->frame); } + buffer->ews->buffers = eina_inlist_remove(buffer->ews->buffers, EINA_INLIST_GET(buffer)); } E_FREE(buffer); } @@ -2651,6 +2646,12 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_res /* reference any existing buffers */ _e_comp_wl_surface_buffer_reference(&ews->buffer_reference, buffer); + if (buffer) + { + if (!buffer->ews) + ews->buffers = eina_inlist_append(ews->buffers, EINA_INLIST_GET(buffer)); + buffer->ews = ews; + } //INF("ATTACHED NEW BUFFER"); e_pixmap_dirty(ews->pixmap); //if (ews->ec) @@ -2658,9 +2659,7 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_res /* if we are setting a null buffer, then unmap the surface */ - if (buffer) - buffer->ews = ews; - else + if (!buffer) { if (ews->mapped) { @@ -2798,9 +2797,7 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res ews->pending.buffer); /* if the pending buffer is NULL, unmap the surface */ - if (ews->pending.buffer) - ews->pending.buffer->ews = ews; - else + if (!ews->pending.buffer) { if (ews->mapped) { diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index c264fc21b..927b1723a 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -5,7 +5,6 @@ # define E_COMP_WL_H # define WL_HIDE_DEPRECATED - # include # include # include @@ -253,6 +252,7 @@ struct _E_Wayland_Surface_Frame_Callback struct _E_Wayland_Buffer { + EINA_INLIST; struct { struct wl_resource *resource; @@ -315,6 +315,7 @@ struct _E_Wayland_Surface E_Client *ec; E_Pixmap *pixmap; + Eina_Inlist *buffers; E_Wayland_Shell_Surface *shell_surface; Eina_Bool mapped : 1; @@ -472,6 +473,15 @@ struct _E_Wayland_Compositor E_Wayland_Shell_Interface shell_interface; +#ifdef WAYLAND_ONLY + Eina_Bool focus : 1; + + unsigned int output_pool; + + struct xkb_rule_names xkb_names; + struct xkb_context *xkb_context; +#endif + Ecore_Event_Handler *kbd_handler; Ecore_Fd_Handler *fd_handler; Ecore_Idler *idler; @@ -480,9 +490,7 @@ struct _E_Wayland_Compositor Eina_Inlist *surfaces; Eina_List *seats; - - struct wl_list outputs; - + void (*ping_cb) (E_Wayland_Surface *ews, unsigned int serial); }; @@ -581,9 +589,13 @@ struct _E_Wayland_Plane /* external variables */ extern EAPI E_Wayland_Compositor *_e_wl_comp; -EINTERN Eina_Bool e_comp_wl_init(void); +EAPI Eina_Bool e_comp_wl_init(void); EINTERN void e_comp_wl_shutdown(void); +#ifdef WAYLAND_ONLY +EAPI int e_comp_wl_input_read(int fd EINA_UNUSED, unsigned int mask EINA_UNUSED, void *data); +#endif + EAPI void wl_seat_init(struct wl_seat *seat); EAPI void wl_seat_release(struct wl_seat *seat); @@ -613,5 +625,14 @@ EAPI void wl_seat_set_selection(struct wl_seat *seat, struct wl_data_source *sou EAPI unsigned int e_comp_wl_time_get(void); EAPI void e_comp_wl_input_modifiers_update(unsigned int serial); +EAPI void e_comp_wl_mouse_button(struct wl_resource *resource, uint32_t serial, uint32_t timestamp, uint32_t button, uint32_t state_w); +EAPI Eina_Bool e_comp_wl_cb_keymap_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED); + +static inline uint64_t +e_comp_wl_id_get(uint32_t client, uint32_t surface) +{ + return ((uint64_t)surface << 32) + (uint64_t)client; +} + # endif #endif diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c index d5c4fdbbd..f2d1dd4c8 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -27,42 +27,7 @@ struct _E_Comp_Data Eina_Bool restack : 1; }; -struct E_Comp_Client_Data -{ - Ecore_X_Window lock_win; - - Ecore_X_Damage damage; // damage region - Ecore_X_Visual vis; // window visual - Ecore_X_Colormap cmap; // colormap of window - -#if 0 //NOT USED - Ecore_X_Pixmap cache_pixmap; // the cached pixmap (1/nth the dimensions) - int cache_w, cache_h; // cached pixmap size -#endif - - Ecore_X_Image *xim; // x image - software fallback - - unsigned char misses; // number of sync misses - - Ecore_X_Window_Attributes initial_attributes; - - unsigned int move_counter; //reduce X calls when moving a window - unsigned int internal_props_set; //don't need to refetch our own internal props - - Eina_Bool moving : 1; - Eina_Bool first_map : 1; - Eina_Bool change_icon : 1; - Eina_Bool need_reparent : 1; - Eina_Bool reparented : 1; - Eina_Bool deleted : 1; - Eina_Bool button_grabbed : 1; - Eina_Bool fetch_exe : 1; - Eina_Bool set_win_type : 1; - Eina_Bool frame_update : 1; - Eina_Bool evas_init : 1; -}; - -static Ecore_X_Time focus_time = 0; +static unsigned int focus_time = 0; static Eina_List *handlers = NULL; static Eina_Hash *clients_win_hash = NULL; static Eina_Hash *damages_hash = NULL; @@ -77,6 +42,10 @@ static int _e_comp_x_mapping_change_disabled = 0; static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 }; static int screen_size_index = -1; +static Ecore_Timer *screensaver_idle_timer = NULL; +static Eina_Bool screensaver_dimmed = EINA_FALSE; + + static inline Ecore_X_Window _e_comp_x_client_window_get(const E_Client *ec) { @@ -334,23 +303,23 @@ _e_comp_x_client_new_helper(E_Client *ec) ec->vkbd.fetch.vkbd = 1; /* loop to check for illume atoms */ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT) - ec->illume.conformant.fetch.conformant = 1; + ec->comp_data->illume.conformant.fetch.conformant = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) - ec->illume.quickpanel.fetch.state = 1; + ec->comp_data->illume.quickpanel.fetch.state = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL) - ec->illume.quickpanel.fetch.quickpanel = 1; + ec->comp_data->illume.quickpanel.fetch.quickpanel = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR) - ec->illume.quickpanel.fetch.priority.major = 1; + ec->comp_data->illume.quickpanel.fetch.priority.major = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR) - ec->illume.quickpanel.fetch.priority.minor = 1; + ec->comp_data->illume.quickpanel.fetch.priority.minor = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE) - ec->illume.quickpanel.fetch.zone = 1; + ec->comp_data->illume.quickpanel.fetch.zone = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED) - ec->illume.drag.fetch.locked = 1; + ec->comp_data->illume.drag.fetch.locked = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG) - ec->illume.drag.fetch.drag = 1; + ec->comp_data->illume.drag.fetch.drag = 1; else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE) - ec->illume.win_state.fetch.state = 1; + ec->comp_data->illume.win_state.fetch.state = 1; else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT) video_parent = EINA_TRUE; else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION) @@ -1649,47 +1618,47 @@ _e_comp_x_property(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_W } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CONFORMANT) { - ec->illume.conformant.fetch.conformant = 1; + ec->comp_data->illume.conformant.fetch.conformant = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) { - ec->illume.quickpanel.fetch.state = 1; + ec->comp_data->illume.quickpanel.fetch.state = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL) { - ec->illume.quickpanel.fetch.quickpanel = 1; + ec->comp_data->illume.quickpanel.fetch.quickpanel = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR) { - ec->illume.quickpanel.fetch.priority.major = 1; + ec->comp_data->illume.quickpanel.fetch.priority.major = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR) { - ec->illume.quickpanel.fetch.priority.minor = 1; + ec->comp_data->illume.quickpanel.fetch.priority.minor = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE) { - ec->illume.quickpanel.fetch.zone = 1; + ec->comp_data->illume.quickpanel.fetch.zone = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED) { - ec->illume.drag.fetch.locked = 1; + ec->comp_data->illume.drag.fetch.locked = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_DRAG) { - ec->illume.drag.fetch.drag = 1; + ec->comp_data->illume.drag.fetch.drag = 1; EC_CHANGED(ec); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE) { - ec->illume.win_state.fetch.state = 1; + ec->comp_data->illume.win_state.fetch.state = 1; EC_CHANGED(ec); } /* @@ -1981,13 +1950,13 @@ _e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_M { E_Client *ec; - if (!e_client_comp_grabbed_get()) return ECORE_CALLBACK_RENEW; ec = e_client_action_get(); if (!ec) return ECORE_CALLBACK_RENEW; + E_COMP_X_PIXMAP_CHECK ECORE_CALLBACK_RENEW; if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW; if (e_client_resizing_get(ec) && ec->netwm.sync.request && - ec->netwm.sync.alarm + ec->comp_data->alarm ) { if ((ecore_loop_time_get() - ec->netwm.sync.send_time) > 0.5) @@ -2008,8 +1977,8 @@ _e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_M * when no new resize-request was added by sync-alarm cb. */ } - e_client_mouse_move(ec, (Evas_Point*)&ev->root); } + e_client_mouse_move(ec, (Evas_Point*)&ev->root); return ECORE_CALLBACK_RENEW; } @@ -2110,7 +2079,7 @@ _e_comp_x_sync_alarm(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event if (ec->netwm.sync.wait) ec->netwm.sync.wait--; - if (ecore_x_sync_counter_query(ec->netwm.sync.counter, &serial)) + if (ecore_x_sync_counter_query(ec->comp_data->sync_counter, &serial)) { E_Client_Pending_Resize *pnd = NULL; @@ -2611,7 +2580,6 @@ _e_comp_x_hook_client_pre_frame_assign(void *d EINA_UNUSED, E_Client *ec) ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); } ec->comp_data->set_win_type = 0; - ecore_evas_show(ec->internal_ecore_evas); } } if (ec->re_manage || ec->visible) @@ -2968,8 +2936,8 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec) &ec->icccm.initial_state, &ec->icccm.icon_pixmap, &ec->icccm.icon_mask, - &ec->icccm.icon_window, - &ec->icccm.window_group, + (Ecore_X_Window*)&ec->icccm.icon_window, + (Ecore_X_Window*)&ec->icccm.window_group, &is_urgent)) { ec->icccm.accepts_focus = accepts_focus; @@ -3178,7 +3146,7 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec) { ec->netwm.sync.request = 1; if (!ecore_x_netwm_sync_counter_get(win, - &ec->netwm.sync.counter)) + &ec->comp_data->sync_counter)) ec->netwm.sync.request = 0; } } @@ -3376,59 +3344,59 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec) ec->vkbd.fetch.vkbd = 0; rem_change = 1; } - if (ec->illume.conformant.fetch.conformant) + if (ec->comp_data->illume.conformant.fetch.conformant) { - ec->illume.conformant.conformant = + ec->comp_data->illume.conformant.conformant = ecore_x_e_illume_conformant_get(win); - ec->illume.conformant.fetch.conformant = 0; + ec->comp_data->illume.conformant.fetch.conformant = 0; } - if (ec->illume.quickpanel.fetch.state) + if (ec->comp_data->illume.quickpanel.fetch.state) { - ec->illume.quickpanel.state = + ec->comp_data->illume.quickpanel.state = ecore_x_e_illume_quickpanel_state_get(win); - ec->illume.quickpanel.fetch.state = 0; + ec->comp_data->illume.quickpanel.fetch.state = 0; } - if (ec->illume.quickpanel.fetch.quickpanel) + if (ec->comp_data->illume.quickpanel.fetch.quickpanel) { - ec->illume.quickpanel.quickpanel = + ec->comp_data->illume.quickpanel.quickpanel = ecore_x_e_illume_quickpanel_get(win); - ec->illume.quickpanel.fetch.quickpanel = 0; + ec->comp_data->illume.quickpanel.fetch.quickpanel = 0; } - if (ec->illume.quickpanel.fetch.priority.major) + if (ec->comp_data->illume.quickpanel.fetch.priority.major) { - ec->illume.quickpanel.priority.major = + ec->comp_data->illume.quickpanel.priority.major = ecore_x_e_illume_quickpanel_priority_major_get(win); - ec->illume.quickpanel.fetch.priority.major = 0; + ec->comp_data->illume.quickpanel.fetch.priority.major = 0; } - if (ec->illume.quickpanel.fetch.priority.minor) + if (ec->comp_data->illume.quickpanel.fetch.priority.minor) { - ec->illume.quickpanel.priority.minor = + ec->comp_data->illume.quickpanel.priority.minor = ecore_x_e_illume_quickpanel_priority_minor_get(win); - ec->illume.quickpanel.fetch.priority.minor = 0; + ec->comp_data->illume.quickpanel.fetch.priority.minor = 0; } - if (ec->illume.quickpanel.fetch.zone) + if (ec->comp_data->illume.quickpanel.fetch.zone) { - ec->illume.quickpanel.zone = + ec->comp_data->illume.quickpanel.zone = ecore_x_e_illume_quickpanel_zone_get(win); - ec->illume.quickpanel.fetch.zone = 0; + ec->comp_data->illume.quickpanel.fetch.zone = 0; } - if (ec->illume.drag.fetch.drag) + if (ec->comp_data->illume.drag.fetch.drag) { - ec->illume.drag.drag = + ec->comp_data->illume.drag.drag = ecore_x_e_illume_drag_get(win); - ec->illume.drag.fetch.drag = 0; + ec->comp_data->illume.drag.fetch.drag = 0; } - if (ec->illume.drag.fetch.locked) + if (ec->comp_data->illume.drag.fetch.locked) { - ec->illume.drag.locked = + ec->comp_data->illume.drag.locked = ecore_x_e_illume_drag_locked_get(win); - ec->illume.drag.fetch.locked = 0; + ec->comp_data->illume.drag.fetch.locked = 0; } - if (ec->illume.win_state.fetch.state) + if (ec->comp_data->illume.win_state.fetch.state) { - ec->illume.win_state.state = + ec->comp_data->illume.win_state.state = ecore_x_e_illume_window_state_get(win); - ec->illume.win_state.fetch.state = 0; + ec->comp_data->illume.win_state.fetch.state = 0; } if (ec->changes.shape) { @@ -3922,8 +3890,12 @@ _e_comp_x_hook_client_focus_unset(void *d EINA_UNUSED, E_Client *ec) static void _e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec) { - E_COMP_X_PIXMAP_CHECK; focus_time = ecore_x_current_time_get(); + if ((e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_X)) + { + e_grabinput_focus(ec->comp->ee_win, E_FOCUS_METHOD_PASSIVE); + return; + } if ((ec->icccm.take_focus) && (ec->icccm.accepts_focus)) { @@ -4062,9 +4034,10 @@ static void _e_comp_x_hook_client_resize_end(void *d EINA_UNUSED, E_Client *ec) { E_COMP_X_PIXMAP_CHECK; - if (!ec->netwm.sync.alarm) return; - eina_hash_del_by_key(alarm_hash, &ec->netwm.sync.alarm); - ecore_x_sync_alarm_free(ec->netwm.sync.alarm); + if (!ec->comp_data->alarm) return; + eina_hash_del_by_key(alarm_hash, &ec->comp_data->alarm); + ecore_x_sync_alarm_free(ec->comp_data->alarm); + ec->comp_data->alarm = 0; ec->netwm.sync.alarm = 0; /* resize to last geometry if sync alarm for it was not yet handled */ if (ec->pending_resize) @@ -4082,9 +4055,9 @@ _e_comp_x_hook_client_resize_begin(void *d EINA_UNUSED, E_Client *ec) { E_COMP_X_PIXMAP_CHECK; if (!ec->netwm.sync.request) return; - eina_hash_add(alarm_hash, &ec->netwm.sync.alarm, ec); - ec->netwm.sync.alarm = ecore_x_sync_alarm_new(ec->netwm.sync.counter); - ec->netwm.sync.serial = 1; + ec->netwm.sync.alarm = ecore_x_sync_alarm_new(ec->comp_data->sync_counter); + eina_hash_add(alarm_hash, &ec->comp_data->alarm, ec); + ec->netwm.sync.alarm = ec->netwm.sync.serial = 1; ec->netwm.sync.wait = 0; ec->netwm.sync.send_time = ecore_loop_time_get(); } @@ -4111,6 +4084,70 @@ _e_comp_x_cb_ping(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_e_comp_x_screensaver_idle_timer_cb(void *d __UNUSED__) +{ + ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL); + screensaver_idle_timer = NULL; + return EINA_FALSE; +} + +static Eina_Bool +_e_comp_x_screensaver_notify_cb(void *data __UNUSED__, int type __UNUSED__, Ecore_X_Event_Screensaver_Notify *ev) +{ + static Eina_Bool saver_on = EINA_FALSE; + if ((ev->on) && (!saver_on)) + { + saver_on = EINA_TRUE; + if (e_config->backlight.idle_dim) + { + double t = e_config->screensaver_timeout - + e_config->backlight.timer; + + if (t < 1.0) t = 1.0; + E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del); + if (e_config->screensaver_enable) + screensaver_idle_timer = ecore_timer_add + (t, _e_comp_x_screensaver_idle_timer_cb, NULL); + if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_DIM) + { + e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_DIM); + screensaver_dimmed = EINA_TRUE; + } + } + else + { + if (!e_screensaver_on_get()) + ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL); + } + } + else if ((!ev->on) && (saver_on)) + { + saver_on = EINA_FALSE; + if (screensaver_idle_timer) + { + E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del); + if (e_config->backlight.idle_dim) + { + if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL) + e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); + } + } + else + { + if (screensaver_dimmed) + { + if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL) + e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); + screensaver_dimmed = EINA_FALSE; + } + if (e_screensaver_on_get()) + ecore_event_add(E_EVENT_SCREENSAVER_OFF, NULL, NULL, NULL); + } + } + return ECORE_CALLBACK_PASS_ON; +} + static Eina_Bool _e_comp_x_cb_frame_extents_request(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event_Frame_Extents_Request *ev) { @@ -4706,6 +4743,7 @@ _e_comp_x_screens_setup(void) } if (!success) break; c = e_comp_new(); + c->comp_type = E_PIXMAP_TYPE_X; success = _e_comp_x_setup(c, root, rw, rh); if (!success) break; } @@ -4806,7 +4844,13 @@ e_comp_x_init(void) _e_comp_x_cb_frame_extents_request, NULL); E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_PING, _e_comp_x_cb_ping, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_comp_x_screensaver_notify_cb, NULL);; + ecore_x_screensaver_custom_blanking_enable(); + + e_screensaver_attrs_set(ecore_x_screensaver_timeout_get(), + ecore_x_screensaver_blank_get(), + ecore_x_screensaver_expose_get()); ecore_x_passive_grab_replay_func_set(_e_comp_x_grab_replay, NULL); e_client_hook_add(E_CLIENT_HOOK_DESK_SET, _e_comp_x_hook_client_desk_set, NULL); @@ -4825,6 +4869,8 @@ e_comp_x_init(void) e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, _e_comp_x_hook_client_focus_unset, NULL); e_client_hook_add(E_CLIENT_HOOK_EVAL_END, _e_comp_x_hook_client_eval_end, NULL); + + if (!e_randr_init()) return 0; if (!e_atoms_init()) return 0; if (!_e_comp_x_screens_setup()) return EINA_FALSE; if (!e_xsettings_init()) @@ -4844,8 +4890,10 @@ e_comp_x_shutdown(void) E_FREE_FUNC(alarm_hash, eina_hash_free); E_FREE_FUNC(frame_extents, eina_hash_free); e_xsettings_shutdown(); + ecore_x_screensaver_custom_blanking_disable(); if (x_fatal) return; e_atoms_shutdown(); + e_randr_shutdown(); /* ecore_x_ungrab(); */ ecore_x_focus_reset(); ecore_x_events_allow_all(); diff --git a/src/bin/e_comp_x.h b/src/bin/e_comp_x.h index a2d6fcaa5..273931cc7 100644 --- a/src/bin/e_comp_x.h +++ b/src/bin/e_comp_x.h @@ -1,7 +1,109 @@ -#ifndef E_COMP_X_H -#define E_COMP_X_H +#ifdef E_TYPEDEFS +# include +# include "e_atoms.h" +# include "e_hints.h" +# include "e_randr.h" + +#else +# ifndef E_COMP_X_H +# define E_COMP_X_H +# include +# include "e_atoms.h" +# include "e_hints.h" +# include "e_randr.h" + +struct _E_Comp_Client_Data +{ + Ecore_X_Window lock_win; + + Ecore_X_Damage damage; // damage region + Ecore_X_Visual vis; // window visual + Ecore_X_Colormap cmap; // colormap of window + +#if 0 //NOT USED + Ecore_X_Pixmap cache_pixmap; // the cached pixmap (1/nth the dimensions) + int cache_w, cache_h; // cached pixmap size +#endif + + Ecore_X_Image *xim; // x image - software fallback + Ecore_X_Sync_Alarm alarm; + Ecore_X_Sync_Counter sync_counter; // netwm sync counter + + unsigned char misses; // number of sync misses + + Ecore_X_Window_Attributes initial_attributes; + + unsigned int move_counter; //reduce X calls when moving a window + unsigned int internal_props_set; //don't need to refetch our own internal props + + struct + { + struct + { + struct + { + unsigned char conformant : 1; + } fetch; + unsigned char conformant : 1; + } conformant; + struct + { + struct + { + unsigned char state : 1; + struct + { + unsigned int major : 1; + unsigned int minor : 1; + } priority; + unsigned char quickpanel : 1; + unsigned char zone : 1; + } fetch; + Ecore_X_Illume_Quickpanel_State state; + struct + { + unsigned int major : 1; + unsigned int minor : 1; + } priority; + unsigned char quickpanel : 1; + int zone; + } quickpanel; + struct + { + struct + { + unsigned char drag : 1; + unsigned char locked : 1; + } fetch; + unsigned char drag : 1; + unsigned char locked : 1; + } drag; + struct + { + struct + { + unsigned char state : 1; + } fetch; + Ecore_X_Illume_Window_State state; + } win_state; + } illume; + + Eina_Bool moving : 1; + Eina_Bool first_map : 1; + Eina_Bool change_icon : 1; + Eina_Bool need_reparent : 1; + Eina_Bool reparented : 1; + Eina_Bool deleted : 1; + Eina_Bool button_grabbed : 1; + Eina_Bool fetch_exe : 1; + Eina_Bool set_win_type : 1; + Eina_Bool frame_update : 1; + Eina_Bool evas_init : 1; +}; EINTERN Eina_Bool e_comp_x_init(void); EINTERN void e_comp_x_shutdown(void); +EAPI void e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window win); +# endif #endif diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index 73e82ff5a..d2940bfe1 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -481,7 +481,7 @@ e_drop_handler_del(E_Drop_Handler *handler) } EAPI int -e_drop_xdnd_register_set(Ecore_X_Window win, int reg) +e_drop_xdnd_register_set(Ecore_Window win, int reg) { if (reg) { @@ -518,12 +518,12 @@ e_drop_handler_responsive_get(const E_Drop_Handler *handler) } EAPI void -e_drop_handler_action_set(Ecore_X_Atom action) +e_drop_handler_action_set(unsigned int action) { _action = action; } -EAPI Ecore_X_Atom +EAPI unsigned int e_drop_handler_action_get(void) { return _action; diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h index 33f2613c1..f88317b1d 100644 --- a/src/bin/e_dnd.h +++ b/src/bin/e_dnd.h @@ -81,13 +81,13 @@ struct _E_Event_Dnd_Enter { void *data; int x, y; - Ecore_X_Atom action; + unsigned int action; }; struct _E_Event_Dnd_Move { int x, y; - Ecore_X_Atom action; + unsigned int action; }; struct _E_Event_Dnd_Leave @@ -142,11 +142,11 @@ EAPI E_Drop_Handler *e_drop_handler_add(E_Object *obj, EAPI void e_drop_handler_geometry_set(E_Drop_Handler *handler, int x, int y, int w, int h); EAPI int e_drop_inside(const E_Drop_Handler *handler, int x, int y); EAPI void e_drop_handler_del(E_Drop_Handler *handler); -EAPI int e_drop_xdnd_register_set(Ecore_X_Window win, int reg); +EAPI int e_drop_xdnd_register_set(Ecore_Window win, int reg); EAPI void e_drop_handler_responsive_set(E_Drop_Handler *handler); EAPI int e_drop_handler_responsive_get(const E_Drop_Handler *handler); -EAPI void e_drop_handler_action_set(Ecore_X_Atom action); -EAPI Ecore_X_Atom e_drop_handler_action_get(void); +EAPI void e_drop_handler_action_set(unsigned int action); +EAPI unsigned int e_drop_handler_action_get(void); EAPI Eina_List *e_dnd_util_text_uri_list_convert(char *data, int size); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index e7ce99905..992063396 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -2546,7 +2546,7 @@ _e_gadcon_client_move_start(E_Gadcon_Client *gcc) evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); else { - ecore_x_pointer_xy_get(e_comp_get(gcc)->ee_win, &gcc->dx, &gcc->dy); + ecore_evas_pointer_xy_get(e_comp_get(gcc)->ee, &gcc->dx, &gcc->dy); evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, NULL, NULL); gcc->dx -= gx; gcc->dy -= gy; diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c index 48c1057bc..215c1a8ac 100644 --- a/src/bin/e_grabinput.c +++ b/src/bin/e_grabinput.c @@ -37,6 +37,7 @@ e_grabinput_shutdown(void) EAPI int e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) { + if (e_comp_get(NULL)->comp_type != E_PIXMAP_TYPE_X) return 1; if (grab_mouse_win) { ecore_x_pointer_ungrab(); @@ -81,6 +82,7 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) EAPI void e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) { + if (e_comp_get(NULL)->comp_type != E_PIXMAP_TYPE_X) return; if (mouse_win == grab_mouse_win) { ecore_x_pointer_ungrab(); @@ -103,6 +105,7 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) EAPI void e_grabinput_focus(Ecore_Window win, E_Focus_Method method) { + if (e_comp_get(NULL)->comp_type != E_PIXMAP_TYPE_X) return; if (grab_key_win != 0) { /* fprintf(stderr, "while grabbed focus changed to %x\n", win); */ diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index 17d9aebe0..3420ebfe1 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -285,6 +285,7 @@ e_hints_client_list_set(void) unsigned int i = 0; Ecore_X_Window *clients = NULL; + if (man->comp->comp_type != E_PIXMAP_TYPE_X) continue; if (man->comp->clients) { E_Client *ec; @@ -377,6 +378,7 @@ e_hints_active_window_set(E_Manager *man, #ifdef WAYLAND_ONLY #else E_OBJECT_CHECK(man); + if (e_comp_get(man)->comp_type != E_PIXMAP_TYPE_X) return; if (ec && (e_pixmap_type_get(ec->pixmap) == E_PIXMAP_TYPE_X)) ecore_x_netwm_client_active_set(man->root, e_client_util_win_get(ec)); else @@ -391,6 +393,7 @@ e_hints_window_init(E_Client *ec) #else E_Remember *rem = NULL; + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->remember) rem = ec->remember; @@ -567,6 +570,7 @@ e_hints_window_state_set(E_Client *ec) Ecore_X_Window_State state[10]; int num = 0; + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->netwm.state.modal) state[num++] = ECORE_X_WINDOW_STATE_MODAL; if (ec->netwm.state.sticky) @@ -612,6 +616,7 @@ e_hints_allowed_action_set(E_Client *ec) Ecore_X_Action action[10]; int num = 0; + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->netwm.action.move) action[num++] = ECORE_X_ACTION_MOVE; if (ec->netwm.action.resize) @@ -642,6 +647,7 @@ e_hints_window_type_set(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_netwm_window_type_set(e_client_util_win_get(ec), ec->netwm.type); #endif } @@ -654,6 +660,7 @@ e_hints_window_type_get(E_Client *ec) Ecore_X_Window_Type *types = NULL; int num, i, j; + if (!e_pixmap_is_x(ec->pixmap)) return; num = ecore_x_netwm_window_types_get(e_client_util_win_get(ec), &types); if (ec->netwm.extra_types) { @@ -700,6 +707,7 @@ e_hints_window_state_update(E_Client *ec, { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; switch (state) { case ECORE_X_WINDOW_STATE_ICONIFIED: @@ -974,6 +982,7 @@ e_hints_window_state_get(E_Client *ec) unsigned int i, num; Ecore_X_Window_State *state; + if (!e_pixmap_is_x(ec->pixmap)) return; ec->netwm.state.modal = 0; ec->netwm.state.sticky = 0; ec->netwm.state.maximized_v = 0; @@ -1055,11 +1064,12 @@ e_hints_window_state_get(E_Client *ec) } EAPI void -e_hints_allowed_action_update(E_Client *ec __UNUSED__, +e_hints_allowed_action_update(E_Client *ec, Ecore_X_Action action) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; switch (action) { case ECORE_X_ACTION_MOVE: @@ -1110,6 +1120,7 @@ e_hints_allowed_action_get(E_Client *ec) unsigned int i; unsigned int num; + if (!e_pixmap_is_x(ec->pixmap)) return; ec->netwm.action.move = 0; ec->netwm.action.resize = 0; ec->netwm.action.minimize = 0; @@ -1197,6 +1208,7 @@ e_hints_window_visible_set(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL) { ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_NORMAL); @@ -1217,6 +1229,7 @@ e_hints_window_iconic_set(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC) { ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_ICONIC); @@ -1237,6 +1250,7 @@ e_hints_window_hidden_set(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) { ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_WITHDRAWN); @@ -1257,6 +1271,7 @@ e_hints_window_shaded_set(E_Client *ec, int on) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.shaded) && (on)) { ec->netwm.update.state = 1; @@ -1282,6 +1297,7 @@ e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_SHADE_DIRECTION, &dir, 1); #endif } @@ -1294,6 +1310,7 @@ e_hints_window_shade_direction_get(E_Client *ec) int ret; E_Direction dir; + if (!e_pixmap_is_x(ec->pixmap)) return E_DIRECTION_UP; ret = ecore_x_window_prop_card32_get(e_client_util_win_get(ec), E_ATOM_SHADE_DIRECTION, &dir, 1); @@ -1311,6 +1328,7 @@ e_hints_window_size_set(E_Client *ec) #else unsigned int sizes[4]; + if (!e_pixmap_is_x(ec->pixmap)) return; sizes[0] = ec->x; sizes[1] = ec->y; sizes[2] = ec->w; @@ -1324,6 +1342,7 @@ e_hints_window_size_unset(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_window_prop_property_del(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE); #endif } @@ -1336,6 +1355,7 @@ e_hints_window_size_get(E_Client *ec) int ret; unsigned int sizes[4]; + if (!e_pixmap_is_x(ec->pixmap)) return 0; memset(sizes, 0, sizeof(sizes)); ret = ecore_x_window_prop_card32_get(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE, sizes, 4); @@ -1356,6 +1376,7 @@ e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if ((horizontal) && (!ec->netwm.state.maximized_h)) { ec->netwm.update.state = 1; @@ -1389,6 +1410,7 @@ e_hints_window_fullscreen_set(E_Client *ec, { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.fullscreen) && (on)) { ec->netwm.update.state = 1; @@ -1409,6 +1431,7 @@ e_hints_window_sticky_set(E_Client *ec, int on) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.sticky) && (on)) { ec->netwm.update.state = 1; @@ -1429,6 +1452,7 @@ e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->netwm.state.stacking == stacking) return; ec->netwm.update.state = 1; ec->netwm.state.stacking = stacking; @@ -1451,6 +1475,7 @@ e_hints_window_desktop_set(E_Client *ec) * a calloc()'d struct and thus has to have been set to 0. hell even * e_client.c explicitly sets it to 0 on creation of the border object. */ + if (!e_pixmap_is_x(ec->pixmap)) return; deskpos[0] = ec->desk->x; deskpos[1] = ec->desk->y; ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_DESK, deskpos, 2); @@ -1472,6 +1497,7 @@ e_hints_window_e_state_get(E_Client *ec) int num = 0, i = 0; int size = 0; + if (!e_pixmap_is_x(ec->pixmap)) return; memset(state, 0, sizeof(state)); /* ugly, but avoids possible future overflow if more states are added */ @@ -1503,6 +1529,7 @@ e_hints_window_qtopia_soft_menu_get(E_Client *ec) #else unsigned int val; + if (!e_pixmap_is_x(ec->pixmap)) return; if (ecore_x_window_prop_card32_get(e_client_util_win_get(ec), ATM__QTOPIA_SOFT_MENU, &val, 1)) ec->qtopia.soft_menu = val; else @@ -1517,6 +1544,7 @@ e_hints_window_qtopia_soft_menus_get(E_Client *ec) #else unsigned int val; + if (!e_pixmap_is_x(ec->pixmap)) return; if (ecore_x_window_prop_card32_get(e_client_util_win_get(ec), ATM__QTOPIA_SOFT_MENUS, &val, 1)) ec->qtopia.soft_menus = val; else @@ -1530,6 +1558,8 @@ e_hints_window_virtual_keyboard_state_get(E_Client *ec) #ifdef WAYLAND_ONLY #else Ecore_X_Atom atom = 0; + + if (!e_pixmap_is_x(ec->pixmap)) return; ec->vkbd.state = ecore_x_e_virtual_keyboard_state_get(e_client_util_win_get(ec)); if (ecore_x_window_prop_atom_get(e_client_util_win_get(ec), ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, @@ -1545,6 +1575,7 @@ e_hints_window_virtual_keyboard_get(E_Client *ec) { #ifdef WAYLAND_ONLY #else + if (!e_pixmap_is_x(ec->pixmap)) return; ec->vkbd.vkbd = ecore_x_e_virtual_keyboard_get(e_client_util_win_get(ec)); #endif } diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h index cba8d036b..0cef41a2c 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -7,6 +7,9 @@ #include "e_error.h" #include "e_zone.h" #include "e_desk.h" +#ifndef WAYLAND_ONLY +# include "e_comp_x.h" +#endif #include "e_pixmap.h" #include "e_comp_object.h" #include "e_client.h" @@ -21,16 +24,13 @@ #include "e_init.h" #include "e_int_menus.h" #include "e_module.h" -#include "e_atoms.h" #include "e_canvas.h" #include "e_focus.h" #include "e_place.h" #include "e_resist.h" #include "e_startup.h" -#include "e_hints.h" #include "e_signals.h" #include "e_xinerama.h" -#include "e_randr.h" #include "e_table.h" #include "e_layout.h" #include "e_font.h" diff --git a/src/bin/e_int_client_menu.c b/src/bin/e_int_client_menu.c index f6ada3f86..9bbf3c6ba 100644 --- a/src/bin/e_int_client_menu.c +++ b/src/bin/e_int_client_menu.c @@ -218,7 +218,7 @@ e_int_client_menu_create(E_Client *ec) } EAPI void -e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp) +e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, unsigned int timestamp) { e_int_client_menu_create(ec); if (key) diff --git a/src/bin/e_int_client_menu.h b/src/bin/e_int_client_menu.h index e5cbe4c75..2915b0f7c 100644 --- a/src/bin/e_int_client_menu.h +++ b/src/bin/e_int_client_menu.h @@ -15,7 +15,7 @@ EAPI E_Client_Menu_Hook *e_int_client_menu_hook_add(E_Client_Menu_Hook_Cb cb, co EAPI void e_int_client_menu_hook_del(E_Client_Menu_Hook *hook); EAPI void e_int_client_menu_hooks_clear(void); EAPI void e_int_client_menu_create(E_Client *ec); -EAPI void e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp); +EAPI void e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, unsigned int timestamp); EAPI void e_int_client_menu_del(E_Client *ec); #endif diff --git a/src/bin/e_int_client_prop.c b/src/bin/e_int_client_prop.c index 8fb112944..cbab64b04 100644 --- a/src/bin/e_int_client_prop.c +++ b/src/bin/e_int_client_prop.c @@ -195,19 +195,19 @@ _create_data(E_Dialog *cfd, E_Client *ec) if (cfdata->client->icccm.window_group != 0) { snprintf(buf, sizeof(buf), "0x%08x", - cfdata->client->icccm.window_group); + (unsigned int)cfdata->client->icccm.window_group); cfdata->icccm.window_group = strdup(buf); } if (cfdata->client->icccm.transient_for != 0) { snprintf(buf, sizeof(buf), "0x%08x", - cfdata->client->icccm.transient_for); + (unsigned int)cfdata->client->icccm.transient_for); cfdata->icccm.transient_for = strdup(buf); } if (cfdata->client->icccm.client_leader != 0) { snprintf(buf, sizeof(buf), "0x%08x", - cfdata->client->icccm.client_leader); + (unsigned int)cfdata->client->icccm.client_leader); cfdata->icccm.client_leader = strdup(buf); } switch (cfdata->client->icccm.gravity) diff --git a/src/bin/e_int_config_comp_match.c b/src/bin/e_int_config_comp_match.c index 948a28c4c..acc197ef4 100644 --- a/src/bin/e_int_config_comp_match.c +++ b/src/bin/e_int_config_comp_match.c @@ -6,8 +6,8 @@ typedef struct _Match_Config E_Comp_Match match; E_Config_Dialog *cfd; char *title, *name, *clas, *role; - int borderless, dialog, accepts_focus, vkbd; - int quickpanel, argb, fullscreen, modal; + int borderless, dialog, accepts_focus; + int argb, fullscreen, modal; } Match_Config; struct _E_Config_Dialog_Data @@ -261,8 +261,6 @@ _edit_ok(void *d1, void *d2) m->match.borderless = m->borderless; m->match.dialog = m->dialog; m->match.accepts_focus = m->accepts_focus; - m->match.vkbd = m->vkbd; - m->match.quickpanel = m->quickpanel; m->match.argb = m->argb; m->match.fullscreen = m->fullscreen; m->match.modal = m->modal; @@ -408,8 +406,6 @@ _create_edit_frame(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdat m->borderless = m->match.borderless; m->dialog = m->match.dialog; m->accepts_focus = m->match.accepts_focus; - m->vkbd = m->match.vkbd; - m->quickpanel = m->match.quickpanel; m->argb = m->match.argb; m->fullscreen = m->match.fullscreen; m->modal = m->match.modal; @@ -463,32 +459,6 @@ _create_edit_frame(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdat e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0); row++; } - if (cfdata->edit_il == cfdata->borders_il) - { - lb = e_widget_label_add(evas, _("Virtual Keyboard")); - e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0); - rg = e_widget_radio_group_new(&m->vkbd); - o = e_widget_radio_add(evas, NULL, 0, rg); - e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0); - o = e_widget_radio_add(evas, NULL, 1, rg); - e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0); - o = e_widget_radio_add(evas, NULL, -1, rg); - e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0); - row++; - } - if (cfdata->edit_il == cfdata->borders_il) - { - lb = e_widget_label_add(evas, _("Quick Panel")); - e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0); - rg = e_widget_radio_group_new(&m->quickpanel); - o = e_widget_radio_add(evas, NULL, 0, rg); - e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0); - o = e_widget_radio_add(evas, NULL, 1, rg); - e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0); - o = e_widget_radio_add(evas, NULL, -1, rg); - e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0); - row++; - } lb = e_widget_label_add(evas, _("ARGB")); e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0); rg = e_widget_radio_group_new(&m->argb); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 77026eb2e..a3b77fba7 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -476,15 +476,6 @@ main(int argc, char **argv) TS("E_Config Init Done"); _e_main_shutdown_push(e_config_shutdown); - TS("E_Randr Init"); - if (!e_randr_init()) - { - e_error_message_show(_("Enlightenment cannot initialize E_Randr!\n")); - } - else - _e_main_shutdown_push(e_randr_shutdown); - TS("E_Randr Init Done"); - TS("E_Env Init"); if (!e_env_init()) { @@ -608,6 +599,18 @@ main(int argc, char **argv) e_menu_init(); e_exehist_init(); + + if (e_config->show_splash) + e_init_status_set(_("Setup Screensaver")); + TS("E_Screensaver Init"); + if (!e_screensaver_init()) + { + e_error_message_show(_("Enlightenment cannot configure the X screensaver.\n")); + _e_main_shutdown(-1); + } + TS("E_Screensaver Init Done"); + _e_main_shutdown_push(e_screensaver_shutdown); + if (e_config->show_splash) e_init_status_set(_("Setup Screens")); TS("Screens Init"); @@ -675,17 +678,6 @@ main(int argc, char **argv) } TS("E_Backlight Init Done"); - if (e_config->show_splash) - e_init_status_set(_("Setup Screensaver")); - TS("E_Screensaver Init"); - if (!e_screensaver_init()) - { - e_error_message_show(_("Enlightenment cannot configure the X screensaver.\n")); - _e_main_shutdown(-1); - } - TS("E_Screensaver Init Done"); - _e_main_shutdown_push(e_screensaver_shutdown); - if (e_config->show_splash) e_init_status_set(_("Setup DPMS")); TS("E_Dpms Init"); diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 0e1480c0d..d00eb4f08 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -184,7 +184,8 @@ e_managers_keys_grab(void) EINA_LIST_FOREACH(managers, l, man) { - e_bindings_key_grab(E_BINDING_CONTEXT_ANY, man->root); + if (man->root) + e_bindings_key_grab(E_BINDING_CONTEXT_ANY, man->root); } ecore_event_add(E_EVENT_MANAGER_KEYS_GRAB, NULL, NULL, NULL); } @@ -197,6 +198,7 @@ e_managers_keys_ungrab(void) EINA_LIST_FOREACH(managers, l, man) { - e_bindings_key_ungrab(E_BINDING_CONTEXT_ANY, man->root); + if (man->root) + e_bindings_key_ungrab(E_BINDING_CONTEXT_ANY, man->root); } } diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c index 5c426fc89..bae3e5893 100644 --- a/src/bin/e_menu.c +++ b/src/bin/e_menu.c @@ -83,13 +83,13 @@ static void _e_menu_category_free_cb(E_Menu_Category *cat); static void _e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED); /* local subsystem globals */ -static Ecore_X_Window _e_menu_win = 0; +static Ecore_Window _e_menu_win = 0; static Eina_List *_e_active_menus = NULL; static E_Menu_Item *_e_active_menu_item = NULL; static E_Menu_Item *_e_prev_active_menu_item = NULL; /*static Eina_Hash *_e_menu_category_items = NULL;*/ static Eina_Hash *_e_menu_categories = NULL; -static Ecore_X_Time _e_menu_activate_time = 0; +static unsigned int _e_menu_activate_time = 0; static int _e_menu_activate_floating = 0; static int _e_menu_activate_maybe_drag = 0; static int _e_menu_activate_dragging = 0; @@ -97,14 +97,14 @@ static Ecore_Animator *_e_menu_scroll_animator = NULL; static double _e_menu_scroll_start = 0.0; static int _e_menu_x = 0; static int _e_menu_y = 0; -static Ecore_X_Time _e_menu_time = 0; +static unsigned int _e_menu_time = 0; static int _e_menu_autoscroll_x = 0; static int _e_menu_autoscroll_y = 0; static Eina_List *handlers = NULL; static Eina_Bool _e_menu_lock = EINA_FALSE; static void -_mouse_up_feed(Evas *e, Ecore_X_Time activate_time) +_mouse_up_feed(Evas *e, unsigned int activate_time) { int button_mask, i; @@ -295,7 +295,7 @@ e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir } EAPI void -e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, Ecore_X_Time activate_time) +e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time) { E_Menu_Item *pmi; @@ -1214,7 +1214,7 @@ e_menu_idler_before(void) } } -EAPI Ecore_X_Window +EAPI Ecore_Window e_menu_grab_window_get(void) { return _e_menu_win; @@ -2842,7 +2842,7 @@ static Eina_Bool _e_menu_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Event_Mouse_Button *ev; - Ecore_X_Time t; + unsigned int t; int ret = 0; ev = event; diff --git a/src/bin/e_menu.h b/src/bin/e_menu.h index 46fbf1def..8206afd77 100644 --- a/src/bin/e_menu.h +++ b/src/bin/e_menu.h @@ -157,7 +157,7 @@ EINTERN int e_menu_shutdown(void); EAPI void e_menu_hide_all(void); EAPI E_Menu *e_menu_new(void); EAPI void e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir); -EAPI void e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, Ecore_X_Time activate_time); +EAPI void e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time); EAPI void e_menu_activate(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir); EAPI void e_menu_deactivate(E_Menu *m); EAPI int e_menu_freeze(E_Menu *m); @@ -203,7 +203,7 @@ EAPI void e_menu_item_disabled_set(E_Menu_Item *mi, int disable); EAPI void e_menu_idler_before(void); -EAPI Ecore_X_Window e_menu_grab_window_get(void); +EAPI Ecore_Window e_menu_grab_window_get(void); #endif #endif diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index 72d91ac95..05c87edc7 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -10,7 +10,7 @@ struct _E_Pixmap { unsigned int refcount; E_Pixmap_Type type; - Ecore_Window win; + uint64_t win; void *visual; void *image; Eina_List *images_cache; @@ -122,7 +122,7 @@ _e_pixmap_find(E_Pixmap_Type type, va_list *l) Ecore_X_Window xwin; #endif #ifdef HAVE_WAYLAND_CLIENTS - unsigned int id; + uint64_t id; #endif if (!pixmaps[type]) return NULL; @@ -135,7 +135,7 @@ _e_pixmap_find(E_Pixmap_Type type, va_list *l) #endif #ifdef HAVE_WAYLAND_CLIENTS case E_PIXMAP_TYPE_WL: - id = va_arg(*l, unsigned int); + id = va_arg(*l, uint64_t); return eina_hash_find(pixmaps[type], &id); #endif default: break; @@ -151,16 +151,16 @@ e_pixmap_free(E_Pixmap *cp) e_pixmap_image_clear(cp, 0); switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL); - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: +#ifdef HAVE_WAYLAND_CLIENTS if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL); - break; #endif + break; } eina_hash_del_by_key(pixmaps[cp->type], &cp->win); return 0; @@ -183,15 +183,15 @@ e_pixmap_new(E_Pixmap_Type type, ...) Ecore_X_Window xwin; #endif #ifdef HAVE_WAYLAND_CLIENTS - unsigned int id; + uint64_t id; #endif EINA_SAFETY_ON_TRUE_RETURN_VAL((type != E_PIXMAP_TYPE_WL) && (type != E_PIXMAP_TYPE_X), NULL); va_start(l, type); switch (type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY xwin = va_arg(l, uint32_t); if (pixmaps[type]) { @@ -207,11 +207,11 @@ e_pixmap_new(E_Pixmap_Type type, ...) cp = _e_pixmap_new(type); cp->win = xwin; eina_hash_add(pixmaps[type], &xwin, cp); - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: - id = va_arg(l, unsigned int); +#ifdef HAVE_WAYLAND_CLIENTS + id = va_arg(l, uint64_t); if (pixmaps[type]) { cp = eina_hash_find(pixmaps[type], &id); @@ -222,12 +222,12 @@ e_pixmap_new(E_Pixmap_Type type, ...) } } else - pixmaps[type] = eina_hash_int32_new((Eina_Free_Cb)_e_pixmap_free); + pixmaps[type] = eina_hash_int64_new((Eina_Free_Cb)_e_pixmap_free); cp = _e_pixmap_new(type); cp->win = id; eina_hash_add(pixmaps[type], &id, cp); - break; #endif + break; } va_end(l); return cp; @@ -319,8 +319,8 @@ e_pixmap_refresh(E_Pixmap *cp) if (!cp->dirty) return EINA_TRUE; switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY { uint32_t pixmap; @@ -347,10 +347,10 @@ e_pixmap_refresh(E_Pixmap *cp) else ecore_x_pixmap_free(pixmap); } - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: +#ifdef HAVE_WAYLAND_CLIENTS { E_Wayland_Surface *ews; E_Wayland_Buffer *buff; @@ -364,9 +364,9 @@ e_pixmap_refresh(E_Pixmap *cp) cp->w = wl_shm_buffer_get_width(shm_buffer); cp->h = wl_shm_buffer_get_height(shm_buffer); success = (cp->w > 0) && (cp->h > 0); - break; } #endif + break; default: break; } if (success) @@ -434,7 +434,7 @@ e_pixmap_find_client(E_Pixmap_Type type, ...) return (!cp) ? NULL : cp->client; } -EAPI Ecore_Window +EAPI uint64_t e_pixmap_window_get(E_Pixmap *cp) { EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0); @@ -470,27 +470,27 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns) ns->version = EVAS_NATIVE_SURFACE_VERSION; switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY ns->type = EVAS_NATIVE_SURFACE_X11; ns->data.x11.visual = cp->visual; ns->data.x11.pixmap = cp->pixmap; - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: return EINA_FALSE; +#ifdef HAVE_WAYLAND_CLIENTS #warning FIXME WL NATIVE SURFACES! ns->type = EVAS_NATIVE_SURFACE_OPENGL; ns->version = EVAS_NATIVE_SURFACE_VERSION; - ns->data.opengl.texture_id = NULL; - ns->data.opengl.framebuffer_id = NULL; + ns->data.opengl.texture_id = 0; + ns->data.opengl.framebuffer_id = 0; ns->data.opengl.x = 0; ns->data.opengl.y = 0; ns->data.opengl.w = cp->w; ns->data.opengl.h = cp->h; - break; #endif + break; default: break; } @@ -506,8 +506,8 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache) cp->failures = 0; switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY if (cache) { void *i; @@ -520,10 +520,10 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache) cp->images_cache = eina_list_append(cp->images_cache, cp->image); cp->image = NULL; } - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: //lel wayland +#ifdef HAVE_WAYLAND_CLIENTS if (cache) { if (cp->copy_image) @@ -547,6 +547,7 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache) cp->copy_image = 1; } #endif + break; default: break; } @@ -565,16 +566,16 @@ e_pixmap_image_refresh(E_Pixmap *cp) } switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY if ((!cp->visual) || (!cp->client->depth)) return EINA_FALSE; cp->image = ecore_x_image_new(cp->w, cp->h, cp->visual, cp->client->depth); if (cp->image) cp->image_argb = ecore_x_image_is_argb32_get(cp->image); - break; #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: +#ifdef HAVE_WAYLAND_CLIENTS { struct wl_shm_buffer *shm_buffer; @@ -586,9 +587,9 @@ e_pixmap_image_refresh(E_Pixmap *cp) if (cp->h != wl_shm_buffer_get_height(shm_buffer)) CRI("ACK!"); cp->image = wl_shm_buffer_get_data(shm_buffer); - break; } #endif + break; default: break; } @@ -616,15 +617,17 @@ e_pixmap_image_data_get(E_Pixmap *cp) if (!cp->image) return NULL; switch (cp->type) { -#ifndef WAYLAND_ONLY case E_PIXMAP_TYPE_X: +#ifndef WAYLAND_ONLY return ecore_x_image_data_get(cp->image, &cp->ibpl, NULL, &cp->ibpp); #endif -#ifdef HAVE_WAYLAND_CLIENTS + break; case E_PIXMAP_TYPE_WL: +#ifdef HAVE_WAYLAND_CLIENTS cp->copy_image = 0; return cp->image; #endif + break; default: break; } diff --git a/src/bin/e_pixmap.h b/src/bin/e_pixmap.h index 4aabd7ede..100e68f89 100644 --- a/src/bin/e_pixmap.h +++ b/src/bin/e_pixmap.h @@ -32,7 +32,7 @@ EAPI Eina_Bool e_pixmap_size_get(E_Pixmap *cp, int *w, int *h); EAPI void e_pixmap_client_set(E_Pixmap *cp, E_Client *ec); EAPI E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...); EAPI E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...); -EAPI Ecore_Window e_pixmap_window_get(E_Pixmap *cp); +EAPI uint64_t e_pixmap_window_get(E_Pixmap *cp); EAPI Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp); EAPI Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns); EAPI void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache); diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index 021f56502..87ccaa1d8 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -81,6 +81,7 @@ e_pointer_window_new(Ecore_X_Window win, { E_Pointer *p = NULL; + if (!win) return NULL; p = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_free); if (!p) return NULL; @@ -225,6 +226,7 @@ e_pointer_idler_before(void) if (!p->e_cursor) continue; if (!p->evas) continue; + if (!p->win) continue; updates = evas_render_updates(p->evas); if ((updates) || (p->hot.update)) diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c index 5383547d5..ff46bc483 100644 --- a/src/bin/e_screensaver.c +++ b/src/bin/e_screensaver.c @@ -3,7 +3,6 @@ static Ecore_Event_Handler *_e_screensaver_handler_on = NULL; static Ecore_Event_Handler *_e_screensaver_handler_off = NULL; static Ecore_Event_Handler *_e_screensaver_handler_config_mode = NULL; -static Ecore_Event_Handler *_e_screensaver_handler_screensaver_notify = NULL; static Ecore_Event_Handler *_e_screensaver_handler_border_fullscreen = NULL; static Ecore_Event_Handler *_e_screensaver_handler_border_unfullscreen = NULL; static Ecore_Event_Handler *_e_screensaver_handler_border_remove = NULL; @@ -83,14 +82,19 @@ e_screensaver_update(void) changed = EINA_TRUE; } - if (changed) ecore_x_screensaver_set(timeout, interval, blanking, expose); + if (changed) +#ifdef WAYLAND_ONLY +#else + ecore_x_screensaver_set(timeout, interval, blanking, expose); +#endif } EAPI void e_screensaver_force_update(void) { int timeout = e_screensaver_timeout_get(EINA_TRUE); - +#ifdef WAYLAND_ONLY +#else ecore_x_screensaver_set(timeout + 10, 0, // e_config->screensaver_interval, @@ -101,6 +105,7 @@ e_screensaver_force_update(void) // e_config->screensaver_interval, e_config->screensaver_blanking, e_config->screensaver_expose); +#endif } static Eina_Bool @@ -274,80 +279,6 @@ _e_screensaver_handler_screensaver_off_cb(void *data __UNUSED__, int type __UNUS return ECORE_CALLBACK_PASS_ON; } -static Ecore_Timer *idle_timer = NULL; -static Eina_Bool saver_on = EINA_FALSE; -static Eina_Bool dimmed = EINA_FALSE; - -static Eina_Bool -_e_screensaver_idle_timer_cb(void *d __UNUSED__) -{ - ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL); - idle_timer = NULL; - return EINA_FALSE; -} - -static Eina_Bool -_e_screensaver_handler_screensaver_notify_cb(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_X_Event_Screensaver_Notify *e = event; - - if ((e->on) && (!saver_on)) - { - saver_on = EINA_TRUE; - if (e_config->backlight.idle_dim) - { - double t = e_config->screensaver_timeout - - e_config->backlight.timer; - - if (t < 1.0) t = 1.0; - if (idle_timer) - { - ecore_timer_del(idle_timer); - idle_timer = NULL; - } - if (e_config->screensaver_enable) - idle_timer = ecore_timer_add - (t, _e_screensaver_idle_timer_cb, NULL); - if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_DIM) - { - e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_DIM); - dimmed = EINA_TRUE; - } - } - else - { - if (!_e_screensaver_on) - ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL); - } - } - else if ((!e->on) && (saver_on)) - { - saver_on = EINA_FALSE; - if (idle_timer) - { - ecore_timer_del(idle_timer); - idle_timer = NULL; - if (e_config->backlight.idle_dim) - { - if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL) - e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); - } - } - else - { - if (dimmed) - { - if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL) - e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); - dimmed = EINA_FALSE; - } - if (_e_screensaver_on) - ecore_event_add(E_EVENT_SCREENSAVER_OFF, NULL, NULL, NULL); - } - } - return ECORE_CALLBACK_PASS_ON; -} - static Eina_Bool _e_screensaver_handler_border_fullscreen_check_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) { @@ -379,16 +310,10 @@ e_screensaver_preinit(void) EINTERN int e_screensaver_init(void) { - ecore_x_screensaver_custom_blanking_enable(); - _e_screensaver_handler_on = ecore_event_handler_add (E_EVENT_SCREENSAVER_ON, _e_screensaver_handler_screensaver_on_cb, NULL); _e_screensaver_handler_off = ecore_event_handler_add (E_EVENT_SCREENSAVER_OFF, _e_screensaver_handler_screensaver_off_cb, NULL); - - _e_screensaver_handler_screensaver_notify = ecore_event_handler_add - (ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_screensaver_handler_screensaver_notify_cb, NULL); - _e_screensaver_handler_config_mode = ecore_event_handler_add (E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL); @@ -410,11 +335,6 @@ e_screensaver_init(void) _e_screensaver_handler_powersave = ecore_event_handler_add (E_EVENT_POWERSAVE_UPDATE, _e_screensaver_handler_powersave_cb, NULL); - _e_screensaver_timeout = ecore_x_screensaver_timeout_get(); -// _e_screensaver_interval = ecore_x_screensaver_interval_get(); - _e_screensaver_blanking = ecore_x_screensaver_blank_get(); - _e_screensaver_expose = ecore_x_screensaver_expose_get(); - e_screensaver_force_update(); return 1; @@ -441,8 +361,6 @@ e_screensaver_shutdown(void) _e_screensaver_suspend_timer = NULL; } - ecore_x_screensaver_custom_blanking_disable(); - if (_e_screensaver_handler_powersave) { ecore_event_handler_del(_e_screensaver_handler_powersave); @@ -455,12 +373,6 @@ e_screensaver_shutdown(void) _e_screensaver_handler_config_mode = NULL; } - if (_e_screensaver_handler_screensaver_notify) - { - ecore_event_handler_del(_e_screensaver_handler_screensaver_notify); - _e_screensaver_handler_screensaver_notify = NULL; - } - if (_e_screensaver_handler_border_fullscreen) { ecore_event_handler_del(_e_screensaver_handler_border_fullscreen); @@ -506,3 +418,17 @@ e_screensaver_shutdown(void) return 1; } +EAPI void +e_screensaver_attrs_set(int timeout, int blanking, int expose) +{ + _e_screensaver_timeout = timeout; +// _e_screensaver_interval = ecore_x_screensaver_interval_get(); + _e_screensaver_blanking = blanking; + _e_screensaver_expose = expose; +} + +EAPI Eina_Bool +e_screensaver_on_get(void) +{ + return _e_screensaver_on; +} diff --git a/src/bin/e_screensaver.h b/src/bin/e_screensaver.h index 9324f69b6..684985d8c 100644 --- a/src/bin/e_screensaver.h +++ b/src/bin/e_screensaver.h @@ -11,7 +11,8 @@ EAPI void e_screensaver_update(void); EAPI void e_screensaver_force_update(void); EAPI int e_screensaver_timeout_get(Eina_Bool use_idle); - +EAPI void e_screensaver_attrs_set(int timeout, int blanking, int expose); +EAPI Eina_Bool e_screensaver_on_get(void); EAPI extern int E_EVENT_SCREENSAVER_ON; EAPI extern int E_EVENT_SCREENSAVER_OFF; diff --git a/src/bin/e_win.c b/src/bin/e_win.c index ef348d6b1..494b5defa 100644 --- a/src/bin/e_win.c +++ b/src/bin/e_win.c @@ -1,4 +1,9 @@ #include "e.h" +#ifdef HAVE_WAYLAND_CLIENTS +# include +# include "e_comp_wl.h" +#endif + /* local subsystem functions */ static void _e_win_free(E_Win *win); @@ -283,7 +288,7 @@ e_win_new(E_Comp *c) win->comp = c; win->ecore_evas = e_canvas_new(c->man->root, 0, 0, 1, 1, 1, 0, - (Ecore_X_Window*)&win->evas_win); + &win->evas_win); e_canvas_add(win->ecore_evas); ecore_evas_data_set(win->ecore_evas, "E_Win", win); ecore_evas_callback_move_set(win->ecore_evas, _e_win_cb_move); @@ -314,7 +319,9 @@ e_win_new(E_Comp *c) win->max_aspect = 0.0; wins = eina_list_append(wins, win); - win->pointer = e_pointer_window_new(win->evas_win, 1); +#warning FIXME WL POINTERS + if (c->man->root) + win->pointer = e_pointer_window_new(win->evas_win, 1); return win; } @@ -323,22 +330,37 @@ e_win_show(E_Win *win) { E_OBJECT_CHECK(win); E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE); + ecore_evas_show(win->ecore_evas); if (!win->client) { - win->client = e_client_new(win->comp, e_pixmap_new(E_PIXMAP_TYPE_X, win->evas_win), 1, 1); -// dont need this - special stuff -// win->client->ignore_first_unmap = 1; +#ifdef HAVE_WAYLAND_CLIENTS + if (!strncmp(ecore_evas_engine_name_get(win->ecore_evas), "wayland", 7)) + { + Ecore_Wl_Window *wl_win; + uint64_t id; + + wl_win = ecore_evas_wayland_window_get(win->ecore_evas); + id = e_comp_wl_id_get(getpid(), ecore_wl_window_surface_id_get(wl_win)); + win->client = e_client_new(win->comp, e_pixmap_new(E_PIXMAP_TYPE_WL, id), 1, 1); + } + else +#endif + win->client = e_client_new(win->comp, e_pixmap_new(E_PIXMAP_TYPE_X, win->evas_win), 1, 1); + EINA_SAFETY_ON_NULL_RETURN(win->client); if (!win->placed) win->client->re_manage = 0; if (win->ecore_evas) win->client->internal_ecore_evas = win->ecore_evas; if (win->state.no_remember) win->client->internal_no_remember = 1; win->client->internal_no_reopen = win->state.no_reopen; - win->client->changes.size = win->client->changes.pos = 1; + win->client->client.w = win->client->w = win->w; + win->client->client.h = win->client->h = win->h; + win->client->take_focus = win->client->changes.size = win->client->changes.pos = 1; EC_CHANGED(win->client); } _e_win_prop_update(win); - ecore_evas_show(win->ecore_evas); + if (win->state.centered) + e_comp_object_util_center(win->client->frame); } EAPI void diff --git a/src/bin/e_win.h b/src/bin/e_win.h index e63137e75..f723cef9c 100644 --- a/src/bin/e_win.h +++ b/src/bin/e_win.h @@ -24,7 +24,7 @@ struct _E_Win E_Client *client; Ecore_Evas *ecore_evas; Evas *evas; - Ecore_Window evas_win; + Ecore_Window evas_win; unsigned char placed : 1; int min_w, min_h, max_w, max_h, base_w, base_h; int step_x, step_y; diff --git a/src/modules/Makefile_conf_bindings.mk b/src/modules/Makefile_conf_bindings.mk index b04a929d6..d57ff1905 100644 --- a/src/modules/Makefile_conf_bindings.mk +++ b/src/modules/Makefile_conf_bindings.mk @@ -7,7 +7,7 @@ conf_bindingspkgdir = $(MDIR)/conf_bindings/$(MODULE_ARCH) conf_bindingspkg_LTLIBRARIES = src/modules/conf_bindings/module.la src_modules_conf_bindings_module_la_LIBADD = $(MOD_LIBS) -src_modules_conf_bindings_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_conf_bindings_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_conf_bindings_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_conf_bindings_module_la_SOURCES = src/modules/conf_bindings/e_mod_main.c \ src/modules/conf_bindings/e_mod_main.h \ diff --git a/src/modules/Makefile_conf_display.mk b/src/modules/Makefile_conf_display.mk index ff509273a..30753da50 100644 --- a/src/modules/Makefile_conf_display.mk +++ b/src/modules/Makefile_conf_display.mk @@ -7,7 +7,7 @@ conf_displaypkgdir = $(MDIR)/conf_display/$(MODULE_ARCH) conf_displaypkg_LTLIBRARIES = src/modules/conf_display/module.la src_modules_conf_display_module_la_LIBADD = $(MOD_LIBS) -src_modules_conf_display_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_conf_display_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_conf_display_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_conf_display_module_la_SOURCES = src/modules/conf_display/e_mod_main.c \ src/modules/conf_display/e_mod_main.h \ diff --git a/src/modules/Makefile_conf_randr.mk b/src/modules/Makefile_conf_randr.mk index fbad3c7ac..b43164bd8 100644 --- a/src/modules/Makefile_conf_randr.mk +++ b/src/modules/Makefile_conf_randr.mk @@ -8,7 +8,7 @@ conf_randrpkgdir = $(MDIR)/conf_randr/$(MODULE_ARCH) conf_randrpkg_LTLIBRARIES = src/modules/conf_randr/module.la src_modules_conf_randr_module_la_LIBADD = $(MOD_LIBS) -src_modules_conf_randr_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_conf_randr_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_conf_randr_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_conf_randr_module_la_SOURCES = src/modules/conf_randr/e_mod_main.c \ src/modules/conf_randr/e_mod_main.h \ diff --git a/src/modules/Makefile_conf_theme.mk b/src/modules/Makefile_conf_theme.mk index 466593efc..939b26693 100644 --- a/src/modules/Makefile_conf_theme.mk +++ b/src/modules/Makefile_conf_theme.mk @@ -7,7 +7,7 @@ conf_themepkgdir = $(MDIR)/conf_theme/$(MODULE_ARCH) conf_themepkg_LTLIBRARIES = src/modules/conf_theme/module.la src_modules_conf_theme_module_la_LIBADD = $(MOD_LIBS) -src_modules_conf_theme_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_conf_theme_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_conf_theme_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_conf_theme_module_la_SOURCES = src/modules/conf_theme/e_mod_main.c \ src/modules/conf_theme/e_mod_main.h \ diff --git a/src/modules/Makefile_everything.mk b/src/modules/Makefile_everything.mk index 3ead867dc..468ca9901 100644 --- a/src/modules/Makefile_everything.mk +++ b/src/modules/Makefile_everything.mk @@ -12,7 +12,7 @@ EVRYHEADERS = src/modules/everything/evry_api.h \ src/modules/everything/evry_types.h src_modules_everything_module_la_LIBADD = $(MOD_LIBS) -src_modules_everything_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_everything_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_everything_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_everything_module_la_SOURCES = $(EVRYHEADERS) \ src/modules/everything/e_mod_main.c \ diff --git a/src/modules/Makefile_fileman.mk b/src/modules/Makefile_fileman.mk index 405dd60a5..827b167f8 100644 --- a/src/modules/Makefile_fileman.mk +++ b/src/modules/Makefile_fileman.mk @@ -8,7 +8,7 @@ filemanpkgdir = $(MDIR)/fileman/$(MODULE_ARCH) filemanpkg_LTLIBRARIES = src/modules/fileman/module.la src_modules_fileman_module_la_LIBADD = $(MOD_LIBS) -src_modules_fileman_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_fileman_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_fileman_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_fileman_module_la_SOURCES = src/modules/fileman/e_mod_main.c \ src/modules/fileman/e_mod_main.h \ diff --git a/src/modules/Makefile_pager.mk b/src/modules/Makefile_pager.mk index d7f75c1d6..c5a153951 100644 --- a/src/modules/Makefile_pager.mk +++ b/src/modules/Makefile_pager.mk @@ -8,7 +8,7 @@ pagerpkgdir = $(MDIR)/pager/$(MODULE_ARCH) pagerpkg_LTLIBRARIES = src/modules/pager/module.la src_modules_pager_module_la_LIBADD = $(MOD_LIBS) -src_modules_pager_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_pager_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_pager_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_pager_module_la_SOURCES = src/modules/pager/e_mod_main.h \ src/modules/pager/e_mod_main.c \ diff --git a/src/modules/Makefile_shot.mk b/src/modules/Makefile_shot.mk index be8c1b29c..0555704dc 100644 --- a/src/modules/Makefile_shot.mk +++ b/src/modules/Makefile_shot.mk @@ -8,7 +8,7 @@ shotpkgdir = $(MDIR)/shot/$(MODULE_ARCH) shotpkg_LTLIBRARIES = src/modules/shot/module.la src_modules_shot_module_la_LIBADD = $(MOD_LIBS) -src_modules_shot_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_shot_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_shot_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_shot_module_la_SOURCES = src/modules/shot/e_mod_main.c diff --git a/src/modules/Makefile_systray.mk b/src/modules/Makefile_systray.mk index bd07ccad7..47fed8d7c 100644 --- a/src/modules/Makefile_systray.mk +++ b/src/modules/Makefile_systray.mk @@ -8,16 +8,19 @@ systraypkgdir = $(MDIR)/systray/$(MODULE_ARCH) systraypkg_LTLIBRARIES = src/modules/systray/module.la src_modules_systray_module_la_LIBADD = $(MOD_LIBS) -src_modules_systray_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_systray_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_systray_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_systray_module_la_SOURCES = src/modules/systray/e_mod_main.h \ src/modules/systray/e_mod_main.c \ - src/modules/systray/e_mod_xembed.c \ src/modules/systray/e_mod_notifier_host_private.h \ src/modules/systray/e_mod_notifier_host.c \ src/modules/systray/e_mod_notifier_host_dbus.c \ src/modules/systray/e_mod_notifier_watcher.c +if ! HAVE_WAYLAND_ONLY +src_modules_systray_module_la_SOURCES += src/modules/systray/e_mod_xembed.c +endif + PHONIES += systray install-systray systray: $(systraypkg_LTLIBRARIES) $(systray_DATA) install-systray: install-systrayDATA install-systraypkgLTLIBRARIES diff --git a/src/modules/Makefile_tiling.mk b/src/modules/Makefile_tiling.mk index 69434825a..befaa7b91 100644 --- a/src/modules/Makefile_tiling.mk +++ b/src/modules/Makefile_tiling.mk @@ -25,7 +25,7 @@ src/modules/tiling/%.edj: src/modules/tiling/%.edc Makefile $(EDJE_CC) $(TILING_EDJE_FLAGS) $< $@ src_modules_tiling_module_la_LIBADD = $(MOD_LIBS) -src_modules_tiling_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_tiling_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_tiling_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_tiling_module_la_SOURCES = src/modules/tiling/e_mod_tiling.c \ src/modules/tiling/e_mod_tiling.h \ diff --git a/src/modules/Makefile_winlist.mk b/src/modules/Makefile_winlist.mk index f05de7c11..8a57b95dd 100644 --- a/src/modules/Makefile_winlist.mk +++ b/src/modules/Makefile_winlist.mk @@ -8,7 +8,7 @@ winlistpkgdir = $(MDIR)/winlist/$(MODULE_ARCH) winlistpkg_LTLIBRARIES = src/modules/winlist/module.la src_modules_winlist_module_la_LIBADD = $(MOD_LIBS) -src_modules_winlist_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_winlist_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_winlist_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_winlist_module_la_SOURCES = src/modules/winlist/e_mod_main.h \ src/modules/winlist/e_mod_main.c \ diff --git a/src/modules/Makefile_wizard.mk b/src/modules/Makefile_wizard.mk index 94a48347c..12e5d9280 100644 --- a/src/modules/Makefile_wizard.mk +++ b/src/modules/Makefile_wizard.mk @@ -127,7 +127,7 @@ src_modules_wizard_page_140_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_wizard_page_140_la_SOURCES = src/modules/wizard/page_140.c src_modules_wizard_page_150_la_LIBADD = $(MOD_LIBS) -src_modules_wizard_page_150_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_wizard_page_150_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_wizard_page_150_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_wizard_page_150_la_SOURCES = src/modules/wizard/page_150.c diff --git a/src/modules/Makefile_xkbswitch.mk b/src/modules/Makefile_xkbswitch.mk index f7cdb2046..7a415ff12 100644 --- a/src/modules/Makefile_xkbswitch.mk +++ b/src/modules/Makefile_xkbswitch.mk @@ -8,7 +8,7 @@ xkbswitchpkgdir = $(MDIR)/xkbswitch/$(MODULE_ARCH) xkbswitchpkg_LTLIBRARIES = src/modules/xkbswitch/module.la src_modules_xkbswitch_module_la_LIBADD = $(MOD_LIBS) -src_modules_xkbswitch_module_la_CPPFLAGS = $(MOD_CPPFLAGS) +src_modules_xkbswitch_module_la_CPPFLAGS = $(MOD_CPPFLAGS) -DNEED_X=1 src_modules_xkbswitch_module_la_LDFLAGS = $(MOD_LDFLAGS) src_modules_xkbswitch_module_la_SOURCES = src/modules/xkbswitch/e_mod_main.c \ src/modules/xkbswitch/e_mod_main.h \ diff --git a/src/modules/contact/e_policy.c b/src/modules/contact/e_policy.c index fd7241607..62994afc2 100644 --- a/src/modules/contact/e_policy.c +++ b/src/modules/contact/e_policy.c @@ -236,7 +236,8 @@ _cb_hook_layout(void *data __UNUSED__, E_Comp *comp) } else { - if (ec->illume.conformant.conformant) +#warning X ONLY! SPANK! SPANK! SPANK!!! + if (ec->comp_data->illume.conformant.conformant) { if (kbd_on != want_kbd) { diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 114516f03..dff5ce4be 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -58,7 +58,6 @@ static void _e_wl_shell_shell_surface_cb_ec_hook_resize_end(void *data, E_Client static void _e_wl_shell_surface_cb_smart_client_resize(void *data, Evas_Object *obj, void *event_info); static void _e_wl_shell_mouse_down_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move); -static void _e_wl_shell_mouse_up_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); /* shell surface interface prototypes */ static void _e_wl_shell_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, unsigned int serial); @@ -617,7 +616,8 @@ _e_wl_shell_shell_surface_create_toplevel(E_Wayland_Surface *ews) e_pixmap_ref(ews->pixmap); ews->ec->argb = 1; ews->ec->no_shape_cut = 1; // specify no input shape cutting for this client - ews->ec->lock_border = ews->ec->borderless = !ews->ec->internal; + ews->ec->borderless = !ews->ec->internal; + ews->ec->lock_border = 1; ews->ec->border.changed = ews->ec->changes.border = !ews->ec->borderless; ews->ec->comp_data = (E_Comp_Client_Data*)ews; ews->ec->icccm.title = eina_stringshare_ref(ews->shell_surface->title); @@ -644,11 +644,13 @@ _e_wl_shell_shell_surface_create_toplevel(E_Wayland_Surface *ews) ews->ec->client.w = ews->geometry.w; ews->ec->client.h = ews->geometry.h; + + ews->ec->visible = 1; + evas_object_show(ews->ec->frame); + evas_object_geometry_set(ews->ec->frame, ews->geometry.x, ews->geometry.y, ews->geometry.w, ews->geometry.h); - evas_object_show(ews->ec->frame); - ews->mapped = EINA_TRUE; } @@ -671,11 +673,12 @@ _e_wl_shell_shell_surface_create_popup(E_Wayland_Surface *ews) /* create the e client for this surface */ ews->ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ews->pixmap)); if (!ews->ec) - ews->ec = e_client_new(comp, ews->pixmap, 1, 0); + ews->ec = e_client_new(comp, ews->pixmap, 1, 1); e_pixmap_ref(ews->pixmap); ews->ec->argb = 1; ews->ec->no_shape_cut = 1; // specify no input shape cutting for this client - ews->ec->lock_border = ews->ec->borderless = !ews->ec->internal; + ews->ec->borderless = !ews->ec->internal; + ews->ec->lock_border = 1; ews->ec->border.changed = ews->ec->changes.border = !ews->ec->borderless; ews->ec->comp_data = (E_Comp_Client_Data*)ews; ews->ec->icccm.title = eina_stringshare_ref(ewss->title); @@ -702,9 +705,14 @@ _e_wl_shell_shell_surface_create_popup(E_Wayland_Surface *ews) ews->ec->client.w = ews->geometry.w; ews->ec->client.h = ews->geometry.h; + + ews->ec->visible = 1; + evas_object_show(ews->ec->frame); + evas_object_geometry_set(ews->ec->frame, ews->geometry.x, ews->geometry.y, ews->geometry.w, ews->geometry.h); - evas_object_show(ews->ec->frame); + + ews->mapped = EINA_TRUE; /* set popup properties */ @@ -817,12 +825,12 @@ _e_wl_shell_shell_surface_configure(E_Wayland_Surface *ews, Evas_Coord x, Evas_C ews->ec->client.x = ews->geometry.x = x; ews->ec->client.y = ews->geometry.y = y; e_comp_object_frame_xy_adjust(ews->ec->frame, x, y, &ews->ec->x, &ews->ec->y); - ews->ec->changes.size = 1; + ews->ec->changes.pos = 1; } ews->ec->client.w = w; ews->ec->client.h = h; e_comp_object_frame_wh_adjust(ews->ec->frame, w, h, &ews->ec->w, &ews->ec->h); - ews->ec->changes.pos = 1; + ews->ec->changes.size = 1; EC_CHANGED(ews->ec); } } @@ -923,19 +931,25 @@ _e_wl_shell_shell_surface_unmap(E_Wayland_Surface *ews) _e_wl_shell_surface_cb_smart_client_resize, ews); - /* surface probably has render updates pending: - * - check ourselves before we wreck ourselves - * - copy image - * - re-render - */ - e_pixmap_image_clear(ews->pixmap, 0); - e_pixmap_dirty(ews->pixmap); - if (e_pixmap_refresh(ews->pixmap)) + if (evas_object_visible_get(ews->ec->frame)) { - e_comp_object_damage(ews->ec->frame, 0, 0, ews->ec->w, ews->ec->h); - e_comp_object_render(ews->ec->frame); + /* surface probably has render updates pending: + * - check ourselves before we wreck ourselves + * - copy image + * - re-render + */ + e_pixmap_image_clear(ews->pixmap, 0); + e_pixmap_dirty(ews->pixmap); + if (e_pixmap_refresh(ews->pixmap)) + { + e_comp_object_damage(ews->ec->frame, 0, 0, ews->ec->w, ews->ec->h); + e_comp_object_dirty(ews->ec->frame); + e_comp_object_render(ews->ec->frame); + } + e_comp_object_render_update_del(ews->ec->frame); + evas_object_pass_events_set(ews->ec->frame, 1); + evas_object_hide(ews->ec->frame); } - e_comp_object_render_update_del(ews->ec->frame); e_object_del(E_OBJECT(ews->ec)); } @@ -1167,13 +1181,12 @@ _e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Obje { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; - Evas_Event_Mouse_Up *ev; + Evas_Event_Mouse_Up *ev = event; int btn = 0; - ev = event; - /* try to cast data to our surface structure */ if (!(ews = data)) return; + if (ews->ec && ews->ec->cur_mouse_action) return; /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) @@ -1187,7 +1200,6 @@ _e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Obje if (ptr->button_count > 0) ptr->button_count--; - /* send this button press to the pointer */ ptr->grab->interface->button(ptr->grab, ev->timestamp, btn, WL_POINTER_BUTTON_STATE_RELEASED); @@ -1208,6 +1220,7 @@ _e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Ob /* try to cast data to our surface structure */ if (!(ews = data)) return; + if (ews->ec && ews->ec->cur_mouse_action) return; /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) @@ -1260,6 +1273,7 @@ _e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_O /* try to cast data to our surface structure */ if (!(ews = data)) return; + if (ews->ec && ews->ec->cur_mouse_action) return; /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) @@ -1313,9 +1327,20 @@ _e_wl_shell_shell_surface_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object /* is the focused surface actually This surface ? */ if (kbd->focus != ews->wl.surface) return; - /* get the keycode for this key from X */ - key = ecore_x_keysym_keycode_get(ev->keyname) - 8; +#ifndef WAYLAND_ONLY + if (_e_wl_comp->kbd_handler) + /* get the keycode for this key from X, since we're definitely in X here */ + key = ecore_x_keysym_keycode_get(ev->keyname) - 8; + else +#endif + { + xkb_keysym_t sym; + sym = xkb_keysym_from_name(ev->key, 0); + if (!sym) + sym = xkb_keysym_from_name(ev->key, XKB_KEYSYM_CASE_INSENSITIVE); + key = sym - 8; + } end = (kbd->keys.data + kbd->keys.size); for (k = kbd->keys.data; k < end; k++) if ((*k == key)) *k = *--end; @@ -1368,8 +1393,20 @@ _e_wl_shell_shell_surface_cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Obje /* if the compositor has a ping callback, call it on this surface */ if (_e_wl_comp->ping_cb) _e_wl_comp->ping_cb(ews, serial); - key = ecore_x_keysym_keycode_get(ev->keyname) - 8; +#ifndef WAYLAND_ONLY + if (_e_wl_comp->kbd_handler) + /* get the keycode for this key from X, since we're definitely in X here */ + key = ecore_x_keysym_keycode_get(ev->keyname) - 8; + else +#endif + { + xkb_keysym_t sym; + sym = xkb_keysym_from_name(ev->key, 0); + if (!sym) + sym = xkb_keysym_from_name(ev->key, XKB_KEYSYM_CASE_INSENSITIVE); + key = sym - 8; + } /* update the keyboards grab properties */ kbd->grab_key = key; kbd->grab_time = ev->timestamp; @@ -1647,7 +1684,6 @@ _e_wl_shell_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct w static void _e_wl_shell_mouse_down_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move) { - INF("MOUSE DOWN: %dx%d", output->x, output->y); if ((button >= 1) && (button <= 3)) { ec->mouse.last_down[button - 1].mx = output->x; @@ -1712,29 +1748,6 @@ _e_wl_shell_mouse_down_helper(E_Client *ec, int button, Evas_Point *output, E_Bi ec->mouse.current.my = output->y; } -static void -_e_wl_shell_mouse_up_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev EINA_UNUSED) -{ - if ((button >= 1) && (button <= 3)) - { - ec->mouse.last_up[button - 1].mx = output->x; - ec->mouse.last_up[button - 1].my = output->y; - ec->mouse.last_up[button - 1].x = ec->x; - ec->mouse.last_up[button - 1].y = ec->y; - } - ec->mouse.current.mx = output->x; - ec->mouse.current.my = output->y; - if ((button >= 1) && (button <= 3)) - { - ec->mouse.last_up[button - 1].mx = output->x; - ec->mouse.last_up[button - 1].my = output->y; - ec->mouse.last_up[button - 1].x = ec->x; - ec->mouse.last_up[button - 1].y = ec->y; - } - - ec->drag.start = 0; -} - static void _e_wl_shell_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, unsigned int serial) { @@ -1786,12 +1799,16 @@ _e_wl_shell_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct w else ev.button = 0; - /* set the clicked location in the binding event */ - e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); + /* set the clicked location in the binding event + * the ptr coords are relative to the client, so adjust them to be canvas + */ + e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, + wl_fixed_to_int(ptr->x) + ewss->surface->ec->client.x, + wl_fixed_to_int(ptr->y) + ewss->surface->ec->client.y, &ev.canvas.x, &ev.canvas.y); /* call our helper function to initiate a move */ _e_wl_shell_mouse_down_helper(ewss->surface->ec, ev.button, - &(Evas_Point){ev.canvas.x + ewss->surface->ec->client.x, ev.canvas.y + ewss->surface->ec->client.y}, + &(Evas_Point){ev.canvas.x, ev.canvas.y}, &ev, EINA_TRUE); } @@ -1852,12 +1869,16 @@ _e_wl_shell_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct else ev.button = 0; - /* set the clicked location in the binding event */ - e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); + /* set the clicked location in the binding event + * the ptr coords are relative to the client, so adjust them to be canvas + */ + e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, + wl_fixed_to_int(ptr->x) + ewss->surface->ec->client.x, + wl_fixed_to_int(ptr->y) + ewss->surface->ec->client.y, &ev.canvas.x, &ev.canvas.y); /* call our helper function to initiate a resize */ _e_wl_shell_mouse_down_helper(ewss->surface->ec, ev.button, - &(Evas_Point){ev.canvas.x + ewss->surface->ec->client.x, ev.canvas.y + ewss->surface->ec->client.y}, + &(Evas_Point){ev.canvas.x, ev.canvas.y}, &ev, EINA_FALSE); } @@ -2008,7 +2029,7 @@ _e_wl_shell_shell_surface_cb_class_set(struct wl_client *client EINA_UNUSED, str eina_stringshare_replace(&ewss->clas, clas); if (!ewss->surface->ec) return; - eina_stringshare_refplace(&ewss->surface->ec->icccm.class, clas); + eina_stringshare_refplace(&ewss->surface->ec->icccm.class, ewss->clas); } /* shell move_grab interface functions */ @@ -2032,7 +2053,7 @@ _e_wl_shell_move_grab_cb_motion(struct wl_pointer_grab *grab EINA_UNUSED, unsign } static void -_e_wl_shell_move_grab_cb_button(struct wl_pointer_grab *grab, unsigned int timestamp EINA_UNUSED, unsigned int button EINA_UNUSED, unsigned int state) +_e_wl_shell_move_grab_cb_button(struct wl_pointer_grab *grab, unsigned int timestamp, unsigned int button, unsigned int state) { E_Wayland_Shell_Grab *ewsg = NULL; struct wl_pointer *ptr; @@ -2061,35 +2082,19 @@ _e_wl_shell_move_grab_cb_button(struct wl_pointer_grab *grab, unsigned int times if ((ptr->button_count == 0) && (state == WL_POINTER_BUTTON_STATE_RELEASED)) { - E_Wayland_Surface *ews = NULL; - E_Binding_Event_Mouse_Button ev; - - if (!(ews = ewsg->shell_surface->surface)) return; - - /* set button property of the binding event */ - if (ptr->grab_button == BTN_LEFT) - ev.button = 1; - else if (ptr->grab_button == BTN_MIDDLE) - ev.button = 2; - else if (ptr->grab_button == BTN_RIGHT) - ev.button = 3; - - /* set the clicked location in the binding event */ - e_comp_object_frame_xy_unadjust(ews->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); - - /* call our helper function to end a move */ - _e_wl_shell_mouse_up_helper(ews->ec, ev.button, - &(Evas_Point){ev.canvas.x + ews->ec->client.x, ev.canvas.y + ews->ec->client.y}, - &ev); + struct wl_list *lst; + struct wl_resource *res; /* end the grab */ _e_wl_shell_grab_end(ewsg); free(grab); - /* set surface geometry */ - _e_wl_shell_shell_surface_configure(ews, ews->ec->x, ews->ec->y, - ews->geometry.w, - ews->geometry.h); + lst = &ptr->focus_resource_list; + if (!wl_list_empty(lst)) + { + wl_resource_for_each(res, lst) + e_comp_wl_mouse_button(res, ptr->grab_serial, timestamp, button, state); + } } } @@ -2114,7 +2119,7 @@ _e_wl_shell_resize_grab_cb_motion(struct wl_pointer_grab *grab EINA_UNUSED, unsi } static void -_e_wl_shell_resize_grab_cb_button(struct wl_pointer_grab *grab, unsigned int timestamp EINA_UNUSED, unsigned int button EINA_UNUSED, unsigned int state) +_e_wl_shell_resize_grab_cb_button(struct wl_pointer_grab *grab, unsigned int timestamp, unsigned int button, unsigned int state) { E_Wayland_Shell_Grab *ewsg = NULL; struct wl_pointer *ptr; @@ -2143,35 +2148,19 @@ _e_wl_shell_resize_grab_cb_button(struct wl_pointer_grab *grab, unsigned int tim if ((ptr->button_count == 0) && (state == WL_POINTER_BUTTON_STATE_RELEASED)) { - E_Wayland_Surface *ews = NULL; - E_Binding_Event_Mouse_Button ev; - - if (!(ews = ewsg->shell_surface->surface)) return; - - /* set button property of the binding event */ - if (ptr->grab_button == BTN_LEFT) - ev.button = 1; - else if (ptr->grab_button == BTN_MIDDLE) - ev.button = 2; - else if (ptr->grab_button == BTN_RIGHT) - ev.button = 3; - - /* set the clicked location in the binding event */ - e_comp_object_frame_xy_unadjust(ews->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); - - /* call our helper function to end a move */ - _e_wl_shell_mouse_up_helper(ews->ec, ev.button, - &(Evas_Point){ev.canvas.x + ews->ec->client.x, ev.canvas.y + ews->ec->client.y}, - &ev); + struct wl_list *lst; + struct wl_resource *res; /* end the grab */ _e_wl_shell_grab_end(ewsg); free(grab); - /* set surface geometry */ - _e_wl_shell_shell_surface_configure(ews, ews->ec->x, ews->ec->y, - ews->geometry.w, - ews->geometry.h); + lst = &ptr->focus_resource_list; + if (!wl_list_empty(lst)) + { + wl_resource_for_each(res, lst) + e_comp_wl_mouse_button(res, ptr->grab_serial, timestamp, button, state); + } } }