diff --git a/legacy/ecore/AUTHORS b/legacy/ecore/AUTHORS index 790ee3ff5f..6830d30cc5 100644 --- a/legacy/ecore/AUTHORS +++ b/legacy/ecore/AUTHORS @@ -11,3 +11,4 @@ Howell Tam Nathan Ingersoll Andrew Elcock Kim Woelders +Sebastian Dransfeld diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c index 1bf3243d9e..8caa17f212 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -552,11 +552,23 @@ _ecore_evas_idle_enter(void *data) } else { - Evas_List *updates; + Evas_List *updates, *l; updates = evas_render_updates(ee->evas); if (updates) { +#if 0 + printf("RENDER [%p] [%ix%i]\n", + ee, ee->w, ee->h); + for (l = updates; l; l = l->next) + { + Evas_Rectangle *r; + + r = l->data; + printf(" render [%i %i %ix%i]\n", + r->x, r->y, r->w, r->h); + } +#endif evas_render_updates_free(updates); } } diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 4d3d62d0c1..0a26c6d2bc 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -724,7 +724,10 @@ typedef enum _Ecore_X_Window_State { /* The following are not documented because they are not * intended for use in applications. */ ECORE_X_WINDOW_STATE_ABOVE, - ECORE_X_WINDOW_STATE_BELOW + ECORE_X_WINDOW_STATE_BELOW, + + /* FIXME: Documentation */ + ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION } Ecore_X_Window_State; @@ -739,6 +742,19 @@ typedef enum _Ecore_X_Window_Type { ECORE_X_WINDOW_TYPE_NORMAL } Ecore_X_Window_Type; +typedef enum _Ecore_X_Action { + ECORE_X_ACTION_MOVE, + ECORE_X_ACTION_RESIZE, + ECORE_X_ACTION_MINIMIZE, + ECORE_X_ACTION_SHADE, + ECORE_X_ACTION_STICK, + ECORE_X_ACTION_MAXIMIZE_HORZ, + ECORE_X_ACTION_MAXIMIZE_VERT, + ECORE_X_ACTION_FULLSCREEN, + ECORE_X_ACTION_CHANGE_DESKTOP, + ECORE_X_ACTION_CLOSE +} Ecore_X_Action; + typedef enum _Ecore_X_Window_Configure_Mask { ECORE_X_WINDOW_CONFIGURE_MASK_X = (1 << 0), ECORE_X_WINDOW_CONFIGURE_MASK_Y = (1 << 1), @@ -1080,6 +1096,7 @@ EAPI int ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_A EAPI void ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, unsigned int n_desks, unsigned int *areas); EAPI void ecore_x_netwm_desk_current_set(Ecore_X_Window root, unsigned int desk); EAPI void ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int n_desks, unsigned int *origins); + EAPI void ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation, int columns, int rows, int starting_corner); EAPI void ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on); EAPI void ecore_x_netwm_client_list_set(Ecore_X_Window root, unsigned int n_clients, Ecore_X_Window * p_clients); EAPI void ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, unsigned int n_clients, Ecore_X_Window * p_clients); @@ -1094,11 +1111,33 @@ EAPI int ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_A EAPI char *ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win); EAPI void ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk); EAPI int ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk); - EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity); - EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity); + EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right, int top, int bottom); + EAPI int ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom); + EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, int top, int bottom, int left_start_y, int left_end_y, int right_start_y, int right_end_y, int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x); + EAPI int ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom, int *left_start_y, int *left_end_y, int *right_start_y, int *right_end_y, int *top_start_x, int *top_end_x, int *bottom_start_x, int *bottom_end_x); + EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height); + EAPI int ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height); +#if 0 + /* FIXME */ + EAPI void ecore_x_netwm_icon_set(); + EAPI int ecore_x_netwm_icon_get(); +#endif + EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, int pid); + EAPI int ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid); + EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win); + EAPI int ecore_x_netwm_handled_icons_get(Ecore_X_Window win); + EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, int time); + EAPI int ecore_x_netwm_user_time_get(Ecore_X_Window win, int *time); + EAPI void ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, int on); EAPI int ecore_x_netwm_window_state_isset(Ecore_X_Window win, Ecore_X_Window_State state); + EAPI void ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type); + EAPI Ecore_X_Window_Type ecore_x_netwm_window_type_get(Ecore_X_Window win); + EAPI int ecore_x_netwm_action_allowed(Ecore_X_Window win, Ecore_X_Action action); + EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity); + EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity); EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb); + EAPI int ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb); EAPI int ecore_x_xinerama_screen_count_get(void); EAPI int ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h); diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X_Atoms.h b/legacy/ecore/src/lib/ecore_x/Ecore_X_Atoms.h index fe33c14bdb..a048c73e34 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X_Atoms.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X_Atoms.h @@ -49,36 +49,43 @@ extern Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS; extern Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS; extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES; extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA; -extern Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP; extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT; +extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA; + +extern Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP; extern Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP; extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST; extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING; extern Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW; - extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLE_ICONS; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE; /*x*/ + +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; @@ -88,8 +95,7 @@ extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; -extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY; - +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; @@ -101,6 +107,12 @@ extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE; extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW; +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; + +extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY; + +extern Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS; +extern Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS; /* Selections */ extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY; diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_netwm.c b/legacy/ecore/src/lib/ecore_x/ecore_x_netwm.c index d83341bf35..be4dd490dd 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_netwm.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_netwm.c @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ /* * _NET_WM... aka Extended Window Manager Hint (EWMH) functions. */ @@ -110,7 +113,7 @@ _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom, /* * Get UTF-8 string property */ -static char * +static char * _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom) { char *str; @@ -141,17 +144,19 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom) /* Set/clear atom in list */ static void -_ecore_x_netwm_atom_list_set(Ecore_X_Atom *atoms, int size, int *count, +_ecore_x_netwm_atom_list_set(Ecore_X_Atom *atoms, int size, int *count, Ecore_X_Atom atom, int set) { - int i, n, in_list; + int i, n, in_list = 0; n = *count; /* Check if atom is in list or not (+get index) */ for (i = 0; i < n; i++) if (atoms[i] == atom) - break; - in_list = i < n; + { + in_list = 1; + break; + } if (set && !in_list) { @@ -180,8 +185,8 @@ Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0; -Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0; Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0; @@ -196,25 +201,41 @@ Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0; +/* + * Pagers + */ +Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0; + /* * Application window specific NetWM hints. */ -Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0; -Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0; -Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0; -Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0; -Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLE_ICONS = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0; + +Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0; @@ -224,6 +245,7 @@ Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0; @@ -235,10 +257,12 @@ Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0; Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0; +Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0; void ecore_x_netwm_init(void) @@ -248,12 +272,15 @@ ecore_x_netwm_init(void) ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = _ATOM_GET("_NET_NUMBER_OF_DESKTOPS"); ECORE_X_ATOM_NET_VIRTUAL_ROOTS = _ATOM_GET("_NET_VIRTUAL_ROOTS"); - ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = _ATOM_GET("_NET_DESKTOP_GEOMETRY"); ECORE_X_ATOM_NET_DESKTOP_NAMES = _ATOM_GET("_NET_DESKTOP_NAMES"); - ECORE_X_ATOM_NET_CURRENT_DESKTOP = _ATOM_GET("_NET_CURRENT_DESKTOP"); + ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = _ATOM_GET("_NET_DESKTOP_GEOMETRY"); ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = _ATOM_GET("_NET_DESKTOP_VIEWPORT"); + ECORE_X_ATOM_NET_DESKTOP_LAYOUT = _ATOM_GET("_NET_DESKTOP_LAYOUT"); ECORE_X_ATOM_NET_WORKAREA = _ATOM_GET("_NET_WORKAREA"); + ECORE_X_ATOM_NET_CURRENT_DESKTOP = _ATOM_GET("_NET_CURRENT_DESKTOP"); + ECORE_X_ATOM_NET_SHOWING_DESKTOP = _ATOM_GET("_NET_SHOWING_DESKTOP"); + ECORE_X_ATOM_NET_CLIENT_LIST = _ATOM_GET("_NET_CLIENT_LIST"); ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = _ATOM_GET("_NET_CLIENT_LIST_STACKING"); @@ -262,22 +289,36 @@ ecore_x_netwm_init(void) ECORE_X_ATOM_NET_CLOSE_WINDOW = _ATOM_GET("_NET_CLOSE_WINDOW"); ECORE_X_ATOM_NET_WM_MOVERESIZE = _ATOM_GET("_NET_WM_MOVERESIZE"); + ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = _ATOM_GET("_NET_MOVERESIZE_WINDOW"); + ECORE_X_ATOM_NET_RESTACK_WINDOW = _ATOM_GET("_NET_RESTACK_WINDOW"); + ECORE_X_ATOM_NET_WM_NAME = _ATOM_GET("_NET_WM_NAME"); ECORE_X_ATOM_NET_WM_VISIBLE_NAME = _ATOM_GET("_NET_WM_VISIBLE_NAME"); ECORE_X_ATOM_NET_WM_ICON_NAME = _ATOM_GET("_NET_WM_ICON_NAME"); ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = _ATOM_GET("_NET_WM_VISIBLE_ICON_NAME"); ECORE_X_ATOM_NET_WM_DESKTOP = _ATOM_GET("_NET_WM_DESKTOP"); - ECORE_X_ATOM_NET_WM_WINDOW_TYPE = _ATOM_GET("_NET_WM_WINDOW_TYPE"); - ECORE_X_ATOM_NET_WM_STATE = _ATOM_GET("_NET_WM_STATE"); - ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = _ATOM_GET("_NET_WM_ALLOWED_ACTIONS"); ECORE_X_ATOM_NET_WM_STRUT = _ATOM_GET("_NET_WM_STRUT"); ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = _ATOM_GET("_NET_WM_STRUT_PARTIAL"); ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = _ATOM_GET("_NET_WM_ICON_GEOMETRY"); ECORE_X_ATOM_NET_WM_ICON = _ATOM_GET("_NET_WM_ICON"); ECORE_X_ATOM_NET_WM_PID = _ATOM_GET("_NET_WM_PID"); + ECORE_X_ATOM_NET_WM_HANDLED_ICONS = _ATOM_GET("_NET_WM_HANDLED_ICONS"); ECORE_X_ATOM_NET_WM_USER_TIME = _ATOM_GET("_NET_WM_USER_TIME"); + ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = _ATOM_GET("_NET_WM_ALLOWED_ACTIONS"); + ECORE_X_ATOM_NET_WM_ACTION_MOVE = _ATOM_GET("_NET_WM_ACTION_MOVE"); + ECORE_X_ATOM_NET_WM_ACTION_RESIZE = _ATOM_GET("_NET_WM_ACTION_RESIZE"); + ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = _ATOM_GET("_NET_WM_ACTION_MINIMIZE"); + ECORE_X_ATOM_NET_WM_ACTION_SHADE = _ATOM_GET("_NET_WM_ACTION_SHADE"); + ECORE_X_ATOM_NET_WM_ACTION_STICK = _ATOM_GET("_NET_WM_ACTION_STICK"); + ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = _ATOM_GET("_NET_WM_ACTION_MAXIMIZE_HORZ"); + ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = _ATOM_GET("_NET_WM_ACTION_MAXIMIZE_VERT"); + ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = _ATOM_GET("_NET_WM_ACTION_FULLSCREEN"); + ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = _ATOM_GET("_NET_WM_ACTION_CHANGE_DESKTOP"); + ECORE_X_ATOM_NET_WM_ACTION_CLOSE = _ATOM_GET("_NET_WM_ACTION_CLOSE"); + + ECORE_X_ATOM_NET_WM_WINDOW_TYPE = _ATOM_GET("_NET_WM_WINDOW_TYPE"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = _ATOM_GET("_NET_WM_WINDOW_TYPE_DESKTOP"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = _ATOM_GET("_NET_WM_WINDOW_TYPE_DOCK"); @@ -293,6 +334,7 @@ ecore_x_netwm_init(void) ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = _ATOM_GET("_NET_WM_WINDOW_TYPE_NORMAL"); + ECORE_X_ATOM_NET_WM_STATE = _ATOM_GET("_NET_WM_STATE"); ECORE_X_ATOM_NET_WM_STATE_MODAL = _ATOM_GET("_NET_WM_STATE_MODAL"); ECORE_X_ATOM_NET_WM_STATE_STICKY = _ATOM_GET("_NET_WM_STATE_STICKY"); ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = @@ -307,10 +349,12 @@ ecore_x_netwm_init(void) ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = _ATOM_GET("_NET_WM_STATE_FULLSCREEN"); ECORE_X_ATOM_NET_WM_STATE_ABOVE = _ATOM_GET("_NET_WM_STATE_ABOVE"); ECORE_X_ATOM_NET_WM_STATE_BELOW = _ATOM_GET("_NET_WM_STATE_BELOW"); + ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = _ATOM_GET("_NET_WM_STATE_DEMANDS_ATTENTION"); ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = _ATOM_GET("_NET_WM_WINDOW_OPACITY"); - + ECORE_X_ATOM_NET_FRAME_EXTENTS = _ATOM_GET("_NET_FRAME_EXTENTS"); + ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = _ATOM_GET("_NET_REQUEST_FRAME_EXTENTS"); } /* @@ -390,6 +434,29 @@ ecore_x_netwm_desk_size_set(Ecore_X_Window root, unsigned int width, 2); } +void +ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int n_desks, + unsigned int *origins) +{ + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, + origins, 2 * n_desks); +} + +void +ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation, + int columns, int rows, + int starting_corner) +{ + int layout[4]; + + layout[0] = orientation; + layout[1] = columns; + layout[2] = rows; + layout[3] = starting_corner; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, + layout, 4); +} + void ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, unsigned int n_desks, unsigned int *areas) @@ -405,14 +472,6 @@ ecore_x_netwm_desk_current_set(Ecore_X_Window root, unsigned int desk) 1); } -void -ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int n_desks, - unsigned int *origins) -{ - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, - origins, 2 * n_desks); -} - void ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on) { @@ -457,26 +516,12 @@ ecore_x_netwm_name_set(Ecore_X_Window win, const char *name) _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name); } -char * +char * ecore_x_netwm_name_get(Ecore_X_Window win) { return _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_NAME); } -void -ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name) -{ - _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, - name); -} - -char * -ecore_x_netwm_icon_name_get(Ecore_X_Window win) -{ - return _ecore_x_window_prop_string_utf8_get(win, - ECORE_X_ATOM_NET_WM_ICON_NAME); -} - void ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name) { @@ -484,13 +529,27 @@ ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name) name); } -char * +char * ecore_x_netwm_visible_name_get(Ecore_X_Window win) { return _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME); } +void +ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name) +{ + _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, + name); +} + +char * +ecore_x_netwm_icon_name_get(Ecore_X_Window win) +{ + return _ecore_x_window_prop_string_utf8_get(win, + ECORE_X_ATOM_NET_WM_ICON_NAME); +} + void ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name) { @@ -499,25 +558,13 @@ ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name) name); } -char * +char * ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win) { return _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); } -void -ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb) -{ - int frames[4]; - - frames[0] = fl; - frames[1] = fr; - frames[2] = ft; - frames[3] = fb; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4); -} - void ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk) { @@ -531,18 +578,176 @@ ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk) desk, 1); } +/* + * _NET_WM_STRUT is deprecated, set both _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL. + */ void -ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity) +ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right, + int top, int bottom) { - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, - &opacity, 1); + int strut[4]; + + ecore_x_netwm_strut_partial_set(win, left, right, top, bottom, 0, 0, 0, 0, 0, 0, 0, 0); + + strut[0] = left; + strut[1] = right; + strut[2] = top; + strut[3] = bottom; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); +} + +/* + * _NET_WM_STRUT is deprecated, check first _NET_WM_STRUT_PARTIAL + * and then _NET_WM_STRUT. + */ +int +ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, + int *top, int *bottom) +{ + int ret = 0; + int left_start_y, left_end_y, right_start_y, right_end_y; + int top_start_x, top_end_x, bottom_start_x, bottom_end_x; + int strut[4]; + + ret = ecore_x_netwm_strut_partial_get(win, left, right, top, bottom, + &left_start_y, &left_end_y, &right_start_y, &right_end_y, + &top_start_x, &top_end_x, &bottom_start_x, &bottom_end_x); + if (ret) + return ret; + + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); + if (ret != 4) + return 0; + + *left = strut[0]; + *right = strut[1]; + *top = strut[2]; + *bottom = strut[3]; + return 1; +} + +void +ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, + int top, int bottom, int left_start_y, int left_end_y, + int right_start_y, int right_end_y, int top_start_x, + int top_end_x, int bottom_start_x, int bottom_end_x) +{ + int strut[12]; + + strut[0] = left; + strut[1] = right; + strut[2] = top; + strut[3] = bottom; + strut[4] = left_start_y; + strut[5] = left_end_y; + strut[6] = right_start_y; + strut[7] = right_end_y; + strut[8] = top_start_x; + strut[9] = top_end_x; + strut[10] = bottom_start_x; + strut[11] = bottom_end_x; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 12); } int -ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity) +ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, + int *top, int *bottom, int *left_start_y, int *left_end_y, + int *right_start_y, int *right_end_y, int *top_start_x, + int *top_end_x, int *bottom_start_x, int *bottom_end_x) { - return ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, - opacity, 1); + int ret = 0; + int strut[12]; + + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12); + if (ret != 12) + return 0; + + *left = strut[0]; + *right = strut[1]; + *top = strut[2]; + *bottom = strut[3]; + *left_start_y = strut[4]; + *left_end_y = strut[5]; + *right_start_y = strut[6]; + *right_end_y = strut[7]; + *top_start_x = strut[8]; + *top_end_x = strut[9]; + *bottom_start_x = strut[10]; + *bottom_end_x = strut[11]; + return 1; +} + +void +ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height) +{ + int geometry[4]; + + geometry[0] = x; + geometry[1] = y; + geometry[2] = width; + geometry[3] = height; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4); +} + +int +ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height) +{ + int ret; + int geometry[4]; + + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4); + if (ret != 4) + return 0; + + *x = geometry[0]; + *y = geometry[1]; + *width = geometry[2]; + *height = geometry[3]; + return 1; +} + +void +ecore_x_netwm_pid_set(Ecore_X_Window win, int pid) +{ + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, + &pid, 1); +} + +int +ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid) +{ + return ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, + pid, 1); +} + +void +ecore_x_netwm_handled_icons_set(Ecore_X_Window win) +{ + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0); +} + +int +ecore_x_netwm_handled_icons_get(Ecore_X_Window win) +{ + int ret = 0; + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0); + return ret == 0 ? 1 : 0; +} + +void +ecore_x_netwm_user_time_set(Ecore_X_Window win, int time) +{ + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, + &time, 1); +} + +int +ecore_x_netwm_user_time_get(Ecore_X_Window win, int *time) +{ + return ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME, + time, 1); } static Ecore_X_Atom @@ -572,6 +777,8 @@ _ecore_x_netwm_state_atom_get(Ecore_X_Window_State s) return ECORE_X_ATOM_NET_WM_STATE_ABOVE; case ECORE_X_WINDOW_STATE_BELOW: return ECORE_X_ATOM_NET_WM_STATE_BELOW; + case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: + return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; default: return 0; } @@ -583,18 +790,18 @@ ecore_x_netwm_window_state_isset(Ecore_X_Window win, Ecore_X_Window_State s) { int num, i, ret = 0; unsigned char *data; - Ecore_X_Atom *states, state; + Ecore_X_Atom *atoms, atom; - state = _ecore_x_netwm_state_atom_get(s); if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE, XA_ATOM, 32, &data, &num)) return ret; - states = (Ecore_X_Atom *) data; + atom = _ecore_x_netwm_state_atom_get(s); + atoms = (Ecore_X_Atom *) data; for (i = 0; i < num; ++i) { - if (states[i] == state) + if (atoms[i] == atom) { ret = 1; break; @@ -615,7 +822,7 @@ ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, i unsigned char *old_data = NULL; atom = _ecore_x_netwm_state_atom_get(state); - + ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE, XA_ATOM, 32, &old_data, &num); oldset = (Ecore_X_Atom *) old_data; @@ -630,10 +837,13 @@ ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, i newset = calloc(num + 1, sizeof(Ecore_X_Atom)); if (!newset) return; data = (unsigned char *) newset; - + for (i = 0; i < num; i++) newset[i] = oldset[i]; - newset[num] = state; + newset[num] = atom; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE, + XA_ATOM, 32, data, num + 1); } else { @@ -650,17 +860,267 @@ ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, i } data = (unsigned char *) newset; for (i = 0; i < num; i++) - if (oldset[i] != state) + if (oldset[i] != atom) newset[j++] = oldset[i]; - } - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE, - XA_ATOM, 32, data, j); + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE, + XA_ATOM, 32, data, num - 1); + } XFree(oldset); free(newset); } +static Ecore_X_Window_Type +_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP) + return ECORE_X_WINDOW_TYPE_DESKTOP; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK) + return ECORE_X_WINDOW_TYPE_DOCK; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR) + return ECORE_X_WINDOW_TYPE_TOOLBAR; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU) + return ECORE_X_WINDOW_TYPE_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY) + return ECORE_X_WINDOW_TYPE_UTILITY; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH) + return ECORE_X_WINDOW_TYPE_SPLASH; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG) + return ECORE_X_WINDOW_TYPE_DIALOG; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL) + return ECORE_X_WINDOW_TYPE_NORMAL; + else + return 0; +} - +static Ecore_X_Atom +_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type) +{ + switch (type) + { + case ECORE_X_WINDOW_TYPE_DESKTOP: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; + case ECORE_X_WINDOW_TYPE_DOCK: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; + case ECORE_X_WINDOW_TYPE_TOOLBAR: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; + case ECORE_X_WINDOW_TYPE_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; + case ECORE_X_WINDOW_TYPE_UTILITY: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; + case ECORE_X_WINDOW_TYPE_SPLASH: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; + case ECORE_X_WINDOW_TYPE_DIALOG: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; + case ECORE_X_WINDOW_TYPE_NORMAL: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; + default: + return 0; + } +} + +/* + * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR + * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG + */ +void +ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type) +{ + Ecore_X_Atom atom; + + atom = _ecore_x_netwm_window_type_atom_get(type); + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + XA_ATOM, 32, (unsigned char *)&atom, 1); +} + +Ecore_X_Window_Type +ecore_x_netwm_window_type_get(Ecore_X_Window win) +{ + int num, i; + Ecore_X_Window_Type ret = ECORE_X_WINDOW_TYPE_NORMAL, type; + unsigned char *data; + Ecore_X_Atom *atoms; + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + XA_ATOM, 32, &data, &num)) + { + /* Check if WM_TRANSIENT_FOR is set */ + if (ecore_x_icccm_transient_for_get(win)) + ret = ECORE_X_WINDOW_TYPE_DIALOG; + return ret; + } + + atoms = (Ecore_X_Atom *) data; + + for (i = 0; i < num; ++i) + { + type = _ecore_x_netwm_window_type_type_get(atoms[i]); + if (type) + { + ret = type; + break; + } + } + + XFree(data); + return ret; +} + +static Ecore_X_Atom +_ecore_x_netwm_action_atom_get(Ecore_X_Action action) +{ + switch (action) + { + case ECORE_X_ACTION_MOVE: + return ECORE_X_ATOM_NET_WM_ACTION_MOVE; + case ECORE_X_ACTION_RESIZE: + return ECORE_X_ATOM_NET_WM_ACTION_RESIZE; + case ECORE_X_ACTION_MINIMIZE: + return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; + case ECORE_X_ACTION_SHADE: + return ECORE_X_ATOM_NET_WM_ACTION_SHADE; + case ECORE_X_ACTION_STICK: + return ECORE_X_ATOM_NET_WM_ACTION_STICK; + case ECORE_X_ACTION_MAXIMIZE_HORZ: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; + case ECORE_X_ACTION_MAXIMIZE_VERT: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; + case ECORE_X_ACTION_FULLSCREEN: + return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; + case ECORE_X_ACTION_CHANGE_DESKTOP: + return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; + case ECORE_X_ACTION_CLOSE: + return ECORE_X_ATOM_NET_WM_ACTION_CLOSE; + default: + return 0; + } +} + +int +ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action) +{ + int num, i, ret = 0; + unsigned char *data; + Ecore_X_Atom *atoms, atom; + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + XA_ATOM, 32, &data, &num)) + return ret; + + atom = _ecore_x_netwm_action_atom_get(action); + atoms = (Ecore_X_Atom *) data; + + for (i = 0; i < num; ++i) + { + if (atom == atoms[i]) + { + ret = 1; + break; + } + } + + XFree(data); + return ret; +} + +void +ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action action, int on) +{ + Ecore_X_Atom atom; + Ecore_X_Atom *oldset = NULL, *newset = NULL; + int i, j = 0, num = 0; + unsigned char *data = NULL; + unsigned char *old_data = NULL; + + atom = _ecore_x_netwm_action_atom_get(action); + + ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + XA_ATOM, 32, &old_data, &num); + oldset = (Ecore_X_Atom *) old_data; + + if (on) + { + if (ecore_x_netwm_allowed_action_isset(win, action)) + { + XFree(old_data); + return; + } + newset = calloc(num + 1, sizeof(Ecore_X_Atom)); + if (!newset) return; + data = (unsigned char *) newset; + + for (i = 0; i < num; i++) + newset[i] = oldset[i]; + newset[num] = atom; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + XA_ATOM, 32, data, num + 1); + } + else + { + if (!ecore_x_netwm_allowed_action_isset(win, action)) + { + XFree(old_data); + return; + } + newset = calloc(num - 1, sizeof(Atom)); + if (!newset) + { + XFree(old_data); + return; + } + data = (unsigned char *) newset; + for (i = 0; i < num; i++) + if (oldset[i] != atom) + newset[j++] = oldset[i]; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + XA_ATOM, 32, data, num - 1); + } + XFree(oldset); + free(newset); +} + +void +ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity) +{ + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + &opacity, 1); +} + +int +ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity) +{ + return ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + opacity, 1); +} + +void +ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb) +{ + int frames[4]; + + frames[0] = fl; + frames[1] = fr; + frames[2] = ft; + frames[3] = fb; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4); +} + +int +ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb) +{ + int ret = 0; + int frames[4]; + + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4); + if (ret != 4) + return 0; + + *fl = frames[0]; + *fr = frames[1]; + *ft = frames[2]; + *fb = frames[3]; + return 1; +} - diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c index d553f56a8d..e4f33c1571 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c @@ -1,7 +1,6 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ - #include "Ecore.h" #include "ecore_x_private.h" #include "Ecore_X.h" @@ -86,17 +85,17 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor } for (i = 0; i < num_ret; i++) - switch (size) { - case 8: - (*data)[i] = prop_ret[i]; - break; - case 16: - ((uint16_t *) *data)[i] = ((uint16_t *) prop_ret)[i]; - break; - case 32: - ((uint32_t *) *data)[i] = ((uint32_t *) prop_ret)[i]; - break; - } + switch (size) { + case 8: + (*data)[i] = prop_ret[i]; + break; + case 16: + ((uint16_t *) *data)[i] = ((uint16_t *) prop_ret)[i]; + break; + case 32: + ((uint32_t *) *data)[i] = ((uint32_t *) prop_ret)[i]; + break; + } XFree(prop_ret); @@ -1156,6 +1155,8 @@ _ecore_x_window_prop_state_atom_get(Ecore_X_Window_State s) return ECORE_X_ATOM_NET_WM_STATE_ABOVE; case ECORE_X_WINDOW_STATE_BELOW: return ECORE_X_ATOM_NET_WM_STATE_BELOW; + case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: + return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; default: return 0; }