Make ecore evas use netwm and icccm, not window_prop.
Window_prop is gone, but maybe resurrect some parts of it as a wrapper around icccm/netwm as convencience functions? SVN revision: 15227
This commit is contained in:
parent
ed3329b628
commit
da60c9de1b
|
@ -391,7 +391,7 @@ handler_x_window_configure(void *data, int type, void *event)
|
|||
e = event;
|
||||
printf("Configure %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
|
||||
printf("Switching desktops to %d\n", desktop);
|
||||
ecore_x_window_prop_desktop_request(e->win, desktop);
|
||||
ecore_x_netwm_desktop_request_send(e->win, 0, desktop);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -507,13 +507,17 @@ void
|
|||
setup_ecore_x_test(void)
|
||||
{
|
||||
char *tmp;
|
||||
int pid;
|
||||
unsigned int desktop;
|
||||
|
||||
win = ecore_x_window_new(0, 0, 0, 120, 60);
|
||||
ecore_x_window_prop_title_set(win, "Ecore Test Program");
|
||||
tmp = ecore_x_window_prop_title_get(win);
|
||||
ecore_x_netwm_name_set(win, "Ecore Test Program");
|
||||
ecore_x_icccm_title_set(win, "Ecore Test Program");
|
||||
printf("Title currently: %s\n", tmp);
|
||||
free(tmp);
|
||||
tmp = ecore_x_window_prop_visible_title_get(win);
|
||||
#if 0
|
||||
/* Visibile title should be set by the wm */
|
||||
tmp = ecore_x_netwm_visible_name_get(win);
|
||||
if (!tmp)
|
||||
{
|
||||
printf("No visible title, setting it to Ecore ... Program\n");
|
||||
|
@ -522,15 +526,18 @@ setup_ecore_x_test(void)
|
|||
}
|
||||
printf("Visible title: %s\n", tmp);
|
||||
free(tmp);
|
||||
tmp = ecore_x_window_prop_icon_name_get(win);
|
||||
#endif
|
||||
ecore_x_netwm_icon_name_get(win, &tmp);
|
||||
if (!tmp)
|
||||
{
|
||||
printf("No icon name, setting it to Ecore_Test\n");
|
||||
ecore_x_window_prop_icon_name_set(win, "Ecore_Test");
|
||||
tmp = ecore_x_window_prop_icon_name_get(win);
|
||||
ecore_x_netwm_icon_name_set(win, "Ecore_Test");
|
||||
ecore_x_netwm_icon_name_get(win, &tmp);
|
||||
}
|
||||
printf("Icon Name: %s\n", tmp);
|
||||
free(tmp);
|
||||
#if 0
|
||||
/* Visibile icon should be set by the wm */
|
||||
tmp = ecore_x_window_prop_visible_icon_name_get(win);
|
||||
if (!tmp)
|
||||
{
|
||||
|
@ -540,18 +547,21 @@ setup_ecore_x_test(void)
|
|||
}
|
||||
printf("Visible icon Name: %s\n", tmp);
|
||||
free(tmp);
|
||||
tmp = ecore_x_window_prop_client_machine_get(win);
|
||||
#endif
|
||||
tmp = ecore_x_icccm_client_machine_get(win);
|
||||
if (tmp)
|
||||
{
|
||||
printf("Client machine: %s\n", tmp);
|
||||
free(tmp);
|
||||
}
|
||||
printf("Pid: %d\n", ecore_x_window_prop_pid_get(win));
|
||||
ecore_x_window_prop_name_class_set(win, "ecore_test", "main");
|
||||
ecore_x_window_prop_desktop_set(win, 1);
|
||||
printf("Window on desktop %lu\n", ecore_x_window_prop_desktop_get(win));
|
||||
ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_DIALOG);
|
||||
ecore_x_window_prop_protocol_set(win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
|
||||
ecore_x_netwm_pid_get(win, &pid);
|
||||
printf("Pid: %d\n", pid);
|
||||
ecore_x_icccm_name_class_set(win, "ecore_test", "main");
|
||||
ecore_x_netwm_desktop_set(win, 1);
|
||||
ecore_x_netwm_desktop_get(win, &desktop);
|
||||
printf("Window on desktop %u\n", desktop);
|
||||
ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_DIALOG);
|
||||
ecore_x_icccm_protocol_set(win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
|
||||
ecore_x_window_show(win);
|
||||
ecore_x_flush();
|
||||
|
||||
|
@ -568,6 +578,7 @@ setup_ecore_x_test(void)
|
|||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, handler_x_window_destroy, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, handler_x_window_configure, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, handler_x_window_delete_request, NULL);
|
||||
/*
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, handler_x_window_prop_title_change, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, handler_x_window_prop_visible_title_change, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, handler_x_window_prop_icon_name_change, NULL);
|
||||
|
@ -575,6 +586,7 @@ setup_ecore_x_test(void)
|
|||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, handler_x_window_prop_name_class_change, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, handler_x_window_prop_client_machine_change, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, handler_x_window_prop_pid_change, NULL);
|
||||
*/
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifndef _ECORE_EVAS_PRIVATE_H
|
||||
#define _ECORE_EVAS_PRIVATE_H
|
||||
|
||||
|
@ -90,6 +93,22 @@ struct _Ecore_Evas_Engine
|
|||
Ecore_X_GC gc;
|
||||
Region damages;
|
||||
unsigned char direct_resize : 1;
|
||||
struct {
|
||||
/*
|
||||
unsigned char modal : 1;
|
||||
*/
|
||||
unsigned char sticky : 1;
|
||||
/*
|
||||
unsigned char maximized_v : 1;
|
||||
unsigned char maximized_h : 1;
|
||||
unsigned char shaded : 1;
|
||||
unsigned char skip_taskbar : 1;
|
||||
unsigned char skip_pager : 1;
|
||||
unsigned char fullscreen : 1;
|
||||
*/
|
||||
unsigned char above : 1;
|
||||
unsigned char below : 1;
|
||||
} state;
|
||||
} x;
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
@ -472,6 +475,157 @@ _ecore_evas_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* FIXME, should be in idler */
|
||||
static void
|
||||
_ecore_evas_size_pos_hints_update(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_x_icccm_size_pos_hints_set(ee->engine.x.win_container,
|
||||
0 /*request_pos */,
|
||||
ECORE_X_GRAVITY_NW /* gravity */,
|
||||
ee->prop.min.w /* min_w */,
|
||||
ee->prop.min.h /* min_h */,
|
||||
ee->prop.max.w /* max_w */,
|
||||
ee->prop.max.h /* max_h */,
|
||||
ee->prop.base.w /* base_w */,
|
||||
ee->prop.base.h /* base_h */,
|
||||
ee->prop.step.w /* step_x */,
|
||||
ee->prop.step.h /* step_y */,
|
||||
0 /* min_aspect */,
|
||||
0 /* max_aspect */);
|
||||
}
|
||||
|
||||
/* FIXME, should be in idler */
|
||||
static void
|
||||
_ecore_evas_state_update(Ecore_Evas *ee)
|
||||
{
|
||||
Ecore_X_Window_State state[10];
|
||||
int num;
|
||||
|
||||
num = 0;
|
||||
|
||||
/*
|
||||
if (bd->client.netwm.state.modal)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_MODAL;
|
||||
*/
|
||||
if (ee->engine.x.state.sticky)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_STICKY;
|
||||
/*
|
||||
if (bd->client.netwm.state.maximized_v)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
|
||||
if (bd->client.netwm.state.maximized_h)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
|
||||
if (bd->client.netwm.state.shaded)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_SHADED;
|
||||
if (bd->client.netwm.state.skip_taskbar)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
|
||||
if (bd->client.netwm.state.skip_pager)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
|
||||
if (bd->client.netwm.state.hidden)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
|
||||
if (bd->client.netwm.state.fullscreen)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
|
||||
*/
|
||||
if (ee->engine.x.state.above)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
|
||||
if (ee->engine.x.state.below)
|
||||
state[num++] = ECORE_X_WINDOW_STATE_BELOW;
|
||||
|
||||
ecore_x_netwm_window_state_set(ee->engine.x.win_container, state, num);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_evas_layer_update(Ecore_Evas *ee)
|
||||
{
|
||||
if (ee->should_be_visible)
|
||||
{
|
||||
/* We need to send a netwm request to the wm */
|
||||
/* FIXME: Do we have to remove old state before adding new? */
|
||||
if (ee->prop.layer < 3)
|
||||
{
|
||||
if (ee->engine.x.state.above)
|
||||
{
|
||||
ee->engine.x.state.above = 0;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
|
||||
}
|
||||
if (!ee->engine.x.state.below)
|
||||
{
|
||||
ee->engine.x.state.below = 1;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_BELOW, -1, 1);
|
||||
}
|
||||
}
|
||||
else if (ee->prop.layer > 5)
|
||||
{
|
||||
if (ee->engine.x.state.below)
|
||||
{
|
||||
ee->engine.x.state.below = 0;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_BELOW, -1, 0);
|
||||
}
|
||||
if (!ee->engine.x.state.above)
|
||||
{
|
||||
ee->engine.x.state.above = 1;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_ABOVE, -1, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ee->engine.x.state.below)
|
||||
{
|
||||
ee->engine.x.state.below = 0;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_BELOW, -1, 0);
|
||||
}
|
||||
if (ee->engine.x.state.above)
|
||||
{
|
||||
ee->engine.x.state.above = 0;
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container,
|
||||
ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just set the state */
|
||||
if (ee->prop.layer < 3)
|
||||
{
|
||||
if ((ee->engine.x.state.above) || (!ee->engine.x.state.below))
|
||||
{
|
||||
ee->engine.x.state.above = 0;
|
||||
ee->engine.x.state.below = 1;
|
||||
_ecore_evas_state_update(ee);
|
||||
}
|
||||
}
|
||||
else if (ee->prop.layer > 5)
|
||||
{
|
||||
if ((!ee->engine.x.state.above) || (ee->engine.x.state.below))
|
||||
{
|
||||
ee->engine.x.state.above = 1;
|
||||
ee->engine.x.state.below = 0;
|
||||
_ecore_evas_state_update(ee);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ee->engine.x.state.above) || (ee->engine.x.state.below))
|
||||
{
|
||||
ee->engine.x.state.above = 0;
|
||||
ee->engine.x.state.below = 0;
|
||||
_ecore_evas_state_update(ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* FIXME: Set gnome layer */
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_idle_enter(void *data __UNUSED__)
|
||||
{
|
||||
|
@ -690,8 +844,10 @@ _ecore_evas_x_free(Ecore_Evas *ee)
|
|||
static void
|
||||
_ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
||||
{
|
||||
if (func) ecore_x_window_prop_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST,1);
|
||||
else ecore_x_window_prop_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 0);
|
||||
if (func)
|
||||
ecore_x_icccm_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
|
||||
else
|
||||
ecore_x_icccm_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 0);
|
||||
ee->func.fn_delete_request = func;
|
||||
}
|
||||
|
||||
|
@ -922,7 +1078,8 @@ _ecore_evas_title_set(Ecore_Evas *ee, const char *t)
|
|||
if (ee->prop.title) free(ee->prop.title);
|
||||
ee->prop.title = NULL;
|
||||
if (t) ee->prop.title = strdup(t);
|
||||
ecore_x_window_prop_title_set(ee->engine.x.win_container, ee->prop.title);
|
||||
ecore_x_icccm_title_set(ee->engine.x.win_container, ee->prop.title);
|
||||
ecore_x_netwm_name_set(ee->engine.x.win_container, ee->prop.title);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -934,7 +1091,7 @@ _ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
|
|||
ee->prop.clas = NULL;
|
||||
ee->prop.name = strdup(n);
|
||||
ee->prop.clas = strdup(c);
|
||||
ecore_x_window_prop_name_class_set(ee->engine.x.win_container, ee->prop.name, ee->prop.clas);
|
||||
ecore_x_icccm_name_class_set(ee->engine.x.win_container, ee->prop.name, ee->prop.clas);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -945,7 +1102,7 @@ _ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
|
|||
if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
|
||||
ee->prop.min.w = w;
|
||||
ee->prop.min.h = h;
|
||||
ecore_x_window_prop_min_size_set(ee->engine.x.win_container, ee->prop.min.w, ee->prop.min.h);
|
||||
_ecore_evas_size_pos_hints_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -956,7 +1113,7 @@ _ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
|
|||
if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
|
||||
ee->prop.max.w = w;
|
||||
ee->prop.max.h = h;
|
||||
ecore_x_window_prop_max_size_set(ee->engine.x.win_container, ee->prop.max.w, ee->prop.max.h);
|
||||
_ecore_evas_size_pos_hints_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -967,7 +1124,7 @@ _ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h)
|
|||
if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
|
||||
ee->prop.base.w = w;
|
||||
ee->prop.base.h = h;
|
||||
ecore_x_window_prop_base_size_set(ee->engine.x.win_container, ee->prop.base.w, ee->prop.base.h);
|
||||
_ecore_evas_size_pos_hints_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -978,7 +1135,7 @@ _ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
|
|||
if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
|
||||
ee->prop.step.w = w;
|
||||
ee->prop.step.h = h;
|
||||
ecore_x_window_prop_step_size_set(ee->engine.x.win_container, ee->prop.step.w, ee->prop.step.h);
|
||||
_ecore_evas_size_pos_hints_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1020,12 +1177,27 @@ _ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, i
|
|||
evas_object_show(ee->prop.cursor.object);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param ee
|
||||
* @param layer If < 3, @a ee will be put below all other windows.
|
||||
* If > 5, @a ee will be "always-on-top"
|
||||
* If = 4, @a ee will be put in the default layer.
|
||||
* Acceptable values range from 1 to 255 (0 reserved for
|
||||
* desktop windows)
|
||||
*/
|
||||
static void
|
||||
_ecore_evas_layer_set(Ecore_Evas *ee, int layer)
|
||||
{
|
||||
if (ee->prop.layer == layer) return;
|
||||
|
||||
/* FIXME: Should this logic be here? */
|
||||
if (layer < 1)
|
||||
layer = 1;
|
||||
else if (layer > 255)
|
||||
layer = 255;
|
||||
|
||||
ee->prop.layer = layer;
|
||||
ecore_x_window_prop_layer_set(ee->engine.x.win_container, ee->prop.layer);
|
||||
_ecore_evas_layer_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1040,8 +1212,30 @@ _ecore_evas_iconified_set(Ecore_Evas *ee, int on)
|
|||
if (((ee->prop.iconified) && (on)) ||
|
||||
((!ee->prop.iconified) && (!on))) return;
|
||||
ee->prop.iconified = on;
|
||||
ecore_x_window_prop_state_request(ee->engine.x.win_container,
|
||||
ECORE_X_WINDOW_STATE_ICONIFIED, on);
|
||||
if (on)
|
||||
{
|
||||
ecore_x_icccm_hints_set(ee->engine.x.win_container,
|
||||
1 /* accepts_focus */,
|
||||
ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */,
|
||||
0 /* icon_pixmap */,
|
||||
0 /* icon_mask */,
|
||||
0 /* icon_window */,
|
||||
0 /* window_group */,
|
||||
0 /* is_urgent */);
|
||||
ecore_x_icccm_iconic_request_send(ee->engine.x.win_container, ee->engine.x.win_root);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_x_icccm_hints_set(ee->engine.x.win_container,
|
||||
1 /* accepts_focus */,
|
||||
ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
|
||||
0 /* icon_pixmap */,
|
||||
0 /* icon_mask */,
|
||||
0 /* icon_window */,
|
||||
0 /* window_group */,
|
||||
0 /* is_urgent */);
|
||||
ecore_evas_show(ee);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1050,17 +1244,33 @@ _ecore_evas_borderless_set(Ecore_Evas *ee, int on)
|
|||
if (((ee->prop.borderless) && (on)) ||
|
||||
((!ee->prop.borderless) && (!on))) return;
|
||||
ee->prop.borderless = on;
|
||||
ecore_x_window_prop_borderless_set(ee->engine.x.win_container, ee->prop.borderless);
|
||||
ecore_x_mwm_borderless_set(ee->engine.x.win_container, ee->prop.borderless);
|
||||
}
|
||||
|
||||
/* FIXME: This function changes the initial state of the ee
|
||||
* whilest the iconic function changes the current state! */
|
||||
static void
|
||||
_ecore_evas_withdrawn_set(Ecore_Evas *ee, int withdrawn)
|
||||
{
|
||||
Ecore_X_Window_State_Hint hint;
|
||||
|
||||
if ((ee->prop.withdrawn && withdrawn) ||
|
||||
(!ee->prop.withdrawn && !withdrawn)) return;
|
||||
|
||||
ee->prop.withdrawn = withdrawn;
|
||||
ecore_x_window_prop_withdrawn_set(ee->engine.x.win_container, ee->prop.withdrawn);
|
||||
if (withdrawn)
|
||||
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
|
||||
else
|
||||
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
|
||||
|
||||
ecore_x_icccm_hints_set(ee->engine.x.win_container,
|
||||
1 /* accepts_focus */,
|
||||
hint /* initial_state */,
|
||||
0 /* icon_pixmap */,
|
||||
0 /* icon_mask */,
|
||||
0 /* icon_window */,
|
||||
0 /* window_group */,
|
||||
0 /* is_urgent */);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1070,8 +1280,12 @@ _ecore_evas_sticky_set(Ecore_Evas *ee, int sticky)
|
|||
(!ee->prop.sticky && !sticky)) return;
|
||||
|
||||
ee->prop.sticky = sticky;
|
||||
ecore_x_window_prop_sticky_set(ee->engine.x.win_container,
|
||||
ee->prop.sticky);
|
||||
ee->engine.x.state.sticky = sticky;
|
||||
if (ee->should_be_visible)
|
||||
ecore_x_netwm_state_request_send(ee->engine.x.win_container, ee->engine.x.win_root,
|
||||
ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
|
||||
else
|
||||
_ecore_evas_state_update(ee);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1087,20 +1301,25 @@ _ecore_evas_override_set(Ecore_Evas *ee, int on)
|
|||
ee->engine.x.win_container = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h);
|
||||
else
|
||||
{
|
||||
Ecore_X_Window_State_Hint hint;
|
||||
if (ee->prop.withdrawn)
|
||||
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
|
||||
else
|
||||
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
|
||||
|
||||
ee->engine.x.win_container = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h);
|
||||
ecore_x_window_prop_title_set(ee->engine.x.win_container, ee->prop.title);
|
||||
ecore_x_window_prop_name_class_set(ee->engine.x.win_container, ee->prop.name, ee->prop.clas);
|
||||
ecore_x_icccm_title_set(ee->engine.x.win_container, ee->prop.title);
|
||||
ecore_x_netwm_name_set(ee->engine.x.win_container, ee->prop.title);
|
||||
ecore_x_icccm_name_class_set(ee->engine.x.win_container, ee->prop.name, ee->prop.clas);
|
||||
if (ee->func.fn_delete_request)
|
||||
ecore_x_window_prop_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
|
||||
ecore_x_window_prop_min_size_set(ee->engine.x.win_container, ee->prop.min.w, ee->prop.min.h);
|
||||
ecore_x_window_prop_max_size_set(ee->engine.x.win_container, ee->prop.max.w, ee->prop.max.h);
|
||||
ecore_x_window_prop_base_size_set(ee->engine.x.win_container, ee->prop.base.w, ee->prop.base.h);
|
||||
ecore_x_window_prop_step_size_set(ee->engine.x.win_container, ee->prop.step.w, ee->prop.step.h);
|
||||
ecore_x_window_prop_borderless_set(ee->engine.x.win_container, ee->prop.borderless);
|
||||
ecore_x_window_prop_layer_set(ee->engine.x.win_container, ee->prop.layer);
|
||||
ecore_x_window_prop_withdrawn_set(ee->engine.x.win_container, ee->prop.withdrawn);
|
||||
ecore_x_window_prop_sticky_set(ee->engine.x.win_container,
|
||||
ee->prop.sticky);
|
||||
ecore_x_icccm_protocol_set(ee->engine.x.win_container, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
|
||||
_ecore_evas_size_pos_hints_update(ee);
|
||||
ecore_x_mwm_borderless_set(ee->engine.x.win_container, ee->prop.borderless);
|
||||
_ecore_evas_layer_update(ee);
|
||||
ecore_x_icccm_hints_set(ee->engine.x.win_container, 1 /* accepts_focus */,
|
||||
hint /* initial_state */, 0 /* icon_pixmap */, 0 /* icon_mask */,
|
||||
0 /* icon_window */, 0 /* window_group */, 0 /* is_urgent */);
|
||||
_ecore_evas_state_update(ee);
|
||||
}
|
||||
ecore_evases_hash = evas_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
|
||||
ecore_x_window_reparent(ee->engine.x.win, ee->engine.x.win_container, 0, 0);
|
||||
|
|
|
@ -773,6 +773,7 @@ extern EAPI int ECORE_X_EVENT_SYNC_COUNTER;
|
|||
extern EAPI int ECORE_X_EVENT_SYNC_ALARM;
|
||||
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST;
|
||||
/*
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE;
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE;
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE;
|
||||
|
@ -781,6 +782,7 @@ extern EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE;
|
|||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE;
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE;
|
||||
*/
|
||||
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST;
|
||||
extern EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST;
|
||||
|
@ -1003,69 +1005,19 @@ EAPI void ecore_x_window_gravity_set(Ecore_X_Window win,
|
|||
EAPI void ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
|
||||
Ecore_X_Gravity grav);
|
||||
|
||||
EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
|
||||
EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
|
||||
EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num);
|
||||
EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
|
||||
unsigned int *val, unsigned int num);
|
||||
EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
|
||||
unsigned int *val, unsigned int len);
|
||||
EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
|
||||
EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
|
||||
EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num);
|
||||
EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property);
|
||||
EAPI void ecore_x_window_prop_property_notify(Ecore_X_Window win, const char *type, long *data);
|
||||
EAPI Ecore_X_Atom *ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret);
|
||||
EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str);
|
||||
EAPI char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type);
|
||||
EAPI void ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t);
|
||||
EAPI char *ecore_x_window_prop_title_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv);
|
||||
EAPI void ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv);
|
||||
EAPI void ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t);
|
||||
EAPI char *ecore_x_window_prop_visible_title_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t);
|
||||
EAPI char *ecore_x_window_prop_icon_name_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t);
|
||||
EAPI char *ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win);
|
||||
EAPI char *ecore_x_window_prop_client_machine_get(Ecore_X_Window win);
|
||||
EAPI pid_t ecore_x_window_prop_pid_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const char *c);
|
||||
EAPI void ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n, char **c);
|
||||
EAPI void ecore_x_window_prop_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, int on);
|
||||
EAPI int ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol);
|
||||
EAPI Ecore_X_WM_Protocol *ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret);
|
||||
EAPI void ecore_x_window_prop_sticky_set(Ecore_X_Window win, int on);
|
||||
EAPI int ecore_x_window_prop_input_mode_set(Ecore_X_Window win, Ecore_X_Window_Input_Mode mode);
|
||||
EAPI int ecore_x_window_prop_initial_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state);
|
||||
EAPI void ecore_x_window_prop_min_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_window_prop_max_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_window_prop_base_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_window_prop_step_size_set(Ecore_X_Window win, int x, int y);
|
||||
EAPI void ecore_x_window_prop_xy_set(Ecore_X_Window win, int x, int y);
|
||||
EAPI void ecore_x_window_prop_borderless_set(Ecore_X_Window win, int borderless);
|
||||
EAPI int ecore_x_window_prop_borderless_get(Ecore_X_Window win);
|
||||
EAPI int ecore_x_window_prop_layer_set(Ecore_X_Window win, int layer);
|
||||
EAPI void ecore_x_window_prop_withdrawn_set(Ecore_X_Window win, int withdrawn);
|
||||
EAPI void ecore_x_window_prop_desktop_request(Ecore_X_Window win, long desktop);
|
||||
EAPI void ecore_x_window_prop_state_request(Ecore_X_Window win, Ecore_X_Window_State state, int action);
|
||||
EAPI void ecore_x_window_prop_desktop_set(Ecore_X_Window win, long desktop);
|
||||
EAPI long ecore_x_window_prop_desktop_get(Ecore_X_Window win);
|
||||
/* API Change: use enum Ecore_X_Window_Type instead */
|
||||
EAPI void ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type);
|
||||
#if 0
|
||||
EAPI void ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Atom type);
|
||||
EAPI void ecore_x_window_prop_window_type_desktop_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_dock_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_toolbar_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_menu_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win);
|
||||
EAPI void ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win);
|
||||
#endif
|
||||
EAPI void ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity);
|
||||
EAPI int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win);
|
||||
EAPI Ecore_X_Atom *ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret);
|
||||
EAPI void ecore_x_window_prop_state_set(Ecore_X_Window win, Ecore_X_Window_State s);
|
||||
EAPI int ecore_x_window_prop_state_isset(Ecore_X_Window win, Ecore_X_Window_State s);
|
||||
EAPI void ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s);
|
||||
|
||||
EAPI void ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask);
|
||||
EAPI void ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win);
|
||||
|
@ -1138,7 +1090,6 @@ EAPI void ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
|
|||
int step_x, int step_y,
|
||||
double min_aspect,
|
||||
double max_aspect);
|
||||
|
||||
EAPI int ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
|
||||
int *request_pos,
|
||||
Ecore_X_Gravity *gravity,
|
||||
|
@ -1148,6 +1099,10 @@ EAPI int ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
|
|||
int *step_x, int *step_y,
|
||||
double *min_aspect,
|
||||
double *max_aspect);
|
||||
EAPI void ecore_x_icccm_min_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_icccm_max_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_icccm_base_size_set(Ecore_X_Window win, int w, int h);
|
||||
EAPI void ecore_x_icccm_step_size_set(Ecore_X_Window win, int x, int y);
|
||||
EAPI void ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
|
||||
EAPI char *ecore_x_icccm_title_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_icccm_protocol_set(Ecore_X_Window win,
|
||||
|
@ -1175,6 +1130,7 @@ EAPI void ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role);
|
|||
EAPI char *ecore_x_icccm_window_role_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l);
|
||||
EAPI Ecore_X_Window ecore_x_icccm_client_leader_get(Ecore_X_Window win);
|
||||
EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root);
|
||||
|
||||
|
||||
typedef enum _Ecore_X_MWM_Hint_Func
|
||||
|
@ -1210,6 +1166,7 @@ EAPI int ecore_x_mwm_hints_get(Ecore_X_Window win,
|
|||
Ecore_X_MWM_Hint_Func *fhint,
|
||||
Ecore_X_MWM_Hint_Decor *dhint,
|
||||
Ecore_X_MWM_Hint_Input *ihint);
|
||||
EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless);
|
||||
|
||||
/* netwm */
|
||||
EAPI void ecore_x_netwm_init(void);
|
||||
|
@ -1262,8 +1219,11 @@ EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned
|
|||
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_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter);
|
||||
EAPI void ecore_x_netwm_ping(Ecore_X_Window win);
|
||||
EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win);
|
||||
EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial);
|
||||
EAPI void ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root, Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set);
|
||||
EAPI void ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ int ECORE_X_EVENT_SYNC_COUNTER = 0;
|
|||
int ECORE_X_EVENT_SYNC_ALARM = 0;
|
||||
|
||||
int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
|
||||
/*
|
||||
int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
|
||||
int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
|
||||
int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
|
||||
|
@ -128,6 +129,7 @@ int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
|
|||
int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
|
||||
int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
|
||||
int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
|
||||
*/
|
||||
|
||||
int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
|
||||
int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
|
||||
|
@ -291,6 +293,7 @@ ecore_x_init(const char *name)
|
|||
ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
|
||||
|
||||
ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
|
||||
/*
|
||||
ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
|
||||
|
@ -299,6 +302,7 @@ ecore_x_init(const char *name)
|
|||
ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = ecore_event_type_new();
|
||||
*/
|
||||
|
||||
ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
|
||||
|
|
|
@ -288,8 +288,11 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
|
|||
int step_x, int step_y,
|
||||
double min_aspect, double max_aspect)
|
||||
{
|
||||
/* FIXME: working here */
|
||||
XSizeHints hint;
|
||||
XSizeHints hint;
|
||||
long mask;
|
||||
|
||||
if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
|
||||
return;
|
||||
|
||||
hint.flags = 0;
|
||||
if (request_pos)
|
||||
|
@ -339,7 +342,7 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
|
|||
int
|
||||
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
|
||||
int *request_pos,
|
||||
Ecore_X_Gravity * gravity,
|
||||
Ecore_X_Gravity *gravity,
|
||||
int *min_w, int *min_h,
|
||||
int *max_w, int *max_h,
|
||||
int *base_w, int *base_h,
|
||||
|
@ -357,6 +360,7 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
|
|||
|
||||
if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
|
||||
return 0;
|
||||
|
||||
if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
|
||||
{
|
||||
if (request_pos)
|
||||
|
@ -510,15 +514,12 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
|
|||
{
|
||||
t = strdup((char *)xprop.value);
|
||||
}
|
||||
else if (ret >= Success)
|
||||
else if ((ret >= Success) && (num > 0))
|
||||
{
|
||||
if ((num >= 1) && (list))
|
||||
{
|
||||
t = strdup(list[0]);
|
||||
}
|
||||
if (list)
|
||||
XFreeStringList(list);
|
||||
t = strdup(list[0]);
|
||||
}
|
||||
if (list)
|
||||
XFreeStringList(list);
|
||||
}
|
||||
|
||||
if (xprop.value) XFree(xprop.value);
|
||||
|
@ -1044,8 +1045,26 @@ ecore_x_icccm_client_leader_get(Ecore_X_Window win)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: move these things in here as they are icccm related */
|
||||
/* send iconify request */
|
||||
void
|
||||
ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
|
||||
{
|
||||
XEvent xev;
|
||||
|
||||
if (!win) return;
|
||||
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.serial = 0;
|
||||
xev.xclient.send_event = True;
|
||||
xev.xclient.display = _ecore_x_disp;
|
||||
xev.xclient.window = win;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
|
||||
xev.xclient.data.l[0] = IconicState;
|
||||
|
||||
XSendEvent(_ecore_x_disp, root, False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
|
||||
}
|
||||
|
||||
/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
|
||||
/* hints. each should go in their own file/section so we know which */
|
||||
|
|
|
@ -76,3 +76,18 @@ ecore_x_mwm_hints_get(Ecore_X_Window win,
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless)
|
||||
{
|
||||
unsigned int data[5] = {0, 0, 0, 0, 0};
|
||||
|
||||
data[0] = 2; /* just set the decorations hint! */
|
||||
data[2] = !borderless;
|
||||
|
||||
ecore_x_window_prop_property_set(win,
|
||||
ECORE_X_ATOM_MOTIF_WM_HINTS,
|
||||
ECORE_X_ATOM_MOTIF_WM_HINTS,
|
||||
32, (void *)data, 5);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,74 +32,6 @@
|
|||
XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
|
||||
(unsigned char *)p_val, cnt)
|
||||
|
||||
/*
|
||||
* Convenience functions. Should probably go elsewhere.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set CARD32 (array) property
|
||||
*/
|
||||
void
|
||||
ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
|
||||
unsigned int *val, unsigned int num)
|
||||
{
|
||||
#if SIZEOF_INT == 4
|
||||
_ATOM_SET_CARD32(win, atom, val, num);
|
||||
#else
|
||||
CARD32 *c32;
|
||||
unsigned int i;
|
||||
|
||||
c32 = malloc(num * sizeof(CARD32));
|
||||
if (!c32)
|
||||
return;
|
||||
for (i = 0; i < num; i++)
|
||||
c32[i] = val[i];
|
||||
_ATOM_SET_CARD32(win, atom, c32, num);
|
||||
free(c32);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Get CARD32 (array) property
|
||||
*
|
||||
* At most len items are returned in val.
|
||||
* If the property was successfully fetched the number of items stored in
|
||||
* val is returned, otherwise -1 is returned.
|
||||
* Note: Return value 0 means that the property exists but has no elements.
|
||||
*/
|
||||
int
|
||||
ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
|
||||
unsigned int *val, unsigned int len)
|
||||
{
|
||||
unsigned char *prop_ret;
|
||||
Atom type_ret;
|
||||
unsigned long bytes_after, num_ret;
|
||||
int format_ret;
|
||||
unsigned int i;
|
||||
int num;
|
||||
|
||||
prop_ret = NULL;
|
||||
XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
|
||||
XA_CARDINAL, &type_ret, &format_ret, &num_ret,
|
||||
&bytes_after, &prop_ret);
|
||||
if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
|
||||
{
|
||||
if (num_ret < len)
|
||||
len = num_ret;
|
||||
for (i = 0; i < len; i++)
|
||||
val[i] = ((unsigned long *)prop_ret)[i];
|
||||
num = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = -1;
|
||||
}
|
||||
if (prop_ret)
|
||||
XFree(prop_ret);
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set UTF-8 string property
|
||||
*/
|
||||
|
@ -880,7 +812,7 @@ ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state,
|
|||
|
||||
if (!num)
|
||||
{
|
||||
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_NET_WM_STATE);
|
||||
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1144,7 @@ ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter
|
|||
}
|
||||
|
||||
void
|
||||
ecore_x_netwm_ping(Ecore_X_Window win)
|
||||
ecore_x_netwm_ping_send(Ecore_X_Window win)
|
||||
{
|
||||
XEvent xev;
|
||||
|
||||
|
@ -1256,3 +1188,51 @@ ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial)
|
|||
|
||||
XSendEvent(_ecore_x_disp, win, False, 0, &xev);
|
||||
}
|
||||
|
||||
void
|
||||
ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root,
|
||||
Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set)
|
||||
{
|
||||
XEvent xev;
|
||||
|
||||
if (!win) return;
|
||||
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.serial = 0;
|
||||
xev.xclient.send_event = True;
|
||||
xev.xclient.display = _ecore_x_disp;
|
||||
xev.xclient.window = win;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
|
||||
xev.xclient.data.l[0] = !!set;
|
||||
xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1);
|
||||
xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2);
|
||||
/* 1 == normal client, if someone wants to use this
|
||||
* function in a pager, this should be 2 */
|
||||
xev.xclient.data.l[3] = 1;
|
||||
xev.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent(_ecore_x_disp, root, False, 0, &xev);
|
||||
}
|
||||
|
||||
void
|
||||
ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop)
|
||||
{
|
||||
XEvent xev;
|
||||
|
||||
if (!win) return;
|
||||
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.serial = 0;
|
||||
xev.xclient.send_event = True;
|
||||
xev.xclient.display = _ecore_x_disp;
|
||||
xev.xclient.window = win;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
|
||||
xev.xclient.data.l[0] = desktop;
|
||||
|
||||
XSendEvent(_ecore_x_disp, root, False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
@ -221,13 +220,12 @@ ecore_x_window_defaults_set(Ecore_X_Window win)
|
|||
* Set _NET_WM_PID
|
||||
*/
|
||||
pid = getpid();
|
||||
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_PID, XA_CARDINAL,
|
||||
32, &pid, 1);
|
||||
ecore_x_netwm_pid_set(win, pid);
|
||||
|
||||
ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
|
||||
ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
|
||||
|
||||
ecore_app_args_get(&argc, &argv);
|
||||
ecore_x_window_prop_command_set(win, argc, argv);
|
||||
ecore_x_icccm_command_set(win, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue