forked from enlightenment/enlightenment
- netwm ping.
- fix netwm state update. SVN revision: 15141
This commit is contained in:
parent
1c7951c07c
commit
56580219b4
|
@ -1443,7 +1443,14 @@ void
|
|||
e_border_act_close_begin(E_Border *bd)
|
||||
{
|
||||
if (bd->client.icccm.delete_request)
|
||||
ecore_x_window_delete_request_send(bd->client.win);
|
||||
{
|
||||
ecore_x_window_delete_request_send(bd->client.win);
|
||||
if (bd->client.netwm.ping)
|
||||
{
|
||||
ecore_x_netwm_ping(bd->client.win);
|
||||
bd->ping = ecore_time_get();
|
||||
}
|
||||
}
|
||||
else
|
||||
e_border_act_kill_begin(bd);
|
||||
}
|
||||
|
@ -3280,9 +3287,22 @@ _e_border_eval(E_Border *bd)
|
|||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (proto[i] == ECORE_X_WM_PROTOCOL_DELETE_REQUEST)
|
||||
bd->client.icccm.delete_request = 1;
|
||||
if (proto[i] == ECORE_X_WM_PROTOCOL_TAKE_FOCUS)
|
||||
{
|
||||
printf("ECORE_X_WM_PROTOCOL_DELETE_REQUEST\n");
|
||||
bd->client.icccm.delete_request = 1;
|
||||
}
|
||||
else if (proto[i] == ECORE_X_WM_PROTOCOL_TAKE_FOCUS)
|
||||
bd->client.icccm.take_focus = 1;
|
||||
else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_PING)
|
||||
{
|
||||
printf("ECORE_X_NET_WM_PROTOCOL_PING\n");
|
||||
bd->client.netwm.ping = 1;
|
||||
}
|
||||
else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST)
|
||||
{
|
||||
printf("ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST\n");
|
||||
bd->client.netwm.sync_request = 1;
|
||||
}
|
||||
}
|
||||
free(proto);
|
||||
}
|
||||
|
@ -4333,10 +4353,7 @@ _e_border_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
E_Border *bd;
|
||||
|
||||
bd = data;
|
||||
if (bd->client.icccm.delete_request)
|
||||
ecore_x_window_delete_request_send(bd->client.win);
|
||||
else
|
||||
e_border_act_close_begin(bd);
|
||||
e_border_act_close_begin(bd);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -183,6 +183,8 @@ struct _E_Border
|
|||
int bottom_start_x;
|
||||
int bottom_end_x;
|
||||
} strut;
|
||||
unsigned char ping : 1;
|
||||
unsigned char sync_request : 1;
|
||||
|
||||
/* NetWM Window state */
|
||||
struct {
|
||||
|
@ -249,6 +251,8 @@ struct _E_Border
|
|||
unsigned char button_grabbed : 1;
|
||||
unsigned char grab : 1;
|
||||
|
||||
double ping;
|
||||
|
||||
unsigned char changed : 1;
|
||||
|
||||
unsigned char ignore_first_unmap;
|
||||
|
|
|
@ -501,6 +501,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
break;
|
||||
case ECORE_X_WINDOW_STATE_STICKY:
|
||||
|
@ -529,6 +530,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if (bd->client.netwm.state.sticky)
|
||||
e_border_stick(bd);
|
||||
else
|
||||
|
@ -561,6 +563,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if ((bd->client.netwm.state.maximized_v)
|
||||
&& (bd->client.netwm.state.maximized_h))
|
||||
e_border_maximize(bd);
|
||||
|
@ -595,6 +598,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if ((bd->client.netwm.state.maximized_v)
|
||||
&& (bd->client.netwm.state.maximized_h))
|
||||
e_border_maximize(bd);
|
||||
|
@ -629,6 +633,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if (bd->client.netwm.state.shaded)
|
||||
e_border_shade(bd, e_hints_window_shade_direction_get(bd));
|
||||
else
|
||||
|
@ -661,6 +666,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
break;
|
||||
case ECORE_X_WINDOW_STATE_SKIP_PAGER:
|
||||
|
@ -690,6 +696,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
{
|
||||
/* FIXME, we have a pager, care about this! */
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
break;
|
||||
case ECORE_X_WINDOW_STATE_HIDDEN:
|
||||
|
@ -721,6 +728,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if (bd->client.netwm.state.fullscreen)
|
||||
e_border_fullscreen(bd);
|
||||
else
|
||||
|
@ -763,6 +771,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if (bd->client.netwm.state.stacking)
|
||||
bd->layer = 150;
|
||||
else
|
||||
|
@ -806,6 +815,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
|
|||
if (changed)
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->changed = 1;
|
||||
if (bd->client.netwm.state.stacking)
|
||||
bd->layer = 50;
|
||||
else
|
||||
|
@ -906,6 +916,7 @@ e_hints_window_visible_set(E_Border *bd)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.hidden = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,6 +932,7 @@ e_hints_window_iconic_set(E_Border *bd)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.hidden = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -936,6 +948,7 @@ e_hints_window_hidden_set(E_Border *bd)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.hidden = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,11 +959,13 @@ e_hints_window_shaded_set(E_Border *bd, int on)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.shaded = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
else if ((bd->client.netwm.state.shaded) && (!on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.shaded = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -982,21 +997,25 @@ e_hints_window_maximized_set(E_Border *bd, int on)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.maximized_v = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
else if ((bd->client.netwm.state.maximized_v) && (!on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.maximized_v = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
if ((!bd->client.netwm.state.maximized_h) && (on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.maximized_h = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
else if ((bd->client.netwm.state.maximized_h) && (!on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.maximized_h = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1007,11 +1026,13 @@ e_hints_window_fullscreen_set(E_Border *bd, int on)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.fullscreen = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
else if ((bd->client.netwm.state.fullscreen) && (!on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.fullscreen = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1022,11 +1043,13 @@ e_hints_window_sticky_set(E_Border *bd, int on)
|
|||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.sticky = 1;
|
||||
bd->changed = 1;
|
||||
}
|
||||
else if ((bd->client.netwm.state.sticky) && (!on))
|
||||
{
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.sticky = 0;
|
||||
bd->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1036,6 +1059,7 @@ e_hints_window_stacking_set(E_Border *bd, E_Stacking stacking)
|
|||
if (bd->client.netwm.state.stacking == stacking) return;
|
||||
bd->client.netwm.update.state = 1;
|
||||
bd->client.netwm.state.stacking = stacking;
|
||||
bd->changed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -10,6 +10,7 @@ static int _e_manager_cb_window_show_request(void *data, int ev_type, void *ev);
|
|||
static int _e_manager_cb_window_configure(void *data, int ev_type, void *ev);
|
||||
static int _e_manager_cb_key_down(void *data, int ev_type, void *ev);
|
||||
static int _e_manager_cb_frame_extents_request(void *data, int ev_type, void *ev);
|
||||
static int _e_manager_cb_ping(void *data, int ev_type, void *ev);
|
||||
#if 0 /* use later - maybe */
|
||||
static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev);
|
||||
static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev);
|
||||
|
@ -95,6 +96,7 @@ e_manager_new(Ecore_X_Window root)
|
|||
h = ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, _e_manager_cb_key_down, man);
|
||||
if (h) man->handlers = evas_list_append(man->handlers, h);
|
||||
h = ecore_event_handler_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, _e_manager_cb_frame_extents_request, man);
|
||||
h = ecore_event_handler_add(ECORE_X_EVENT_PING, _e_manager_cb_ping, man);
|
||||
if (h) man->handlers = evas_list_append(man->handlers, h);
|
||||
|
||||
return man;
|
||||
|
@ -509,6 +511,25 @@ _e_manager_cb_frame_extents_request(void *data, int ev_type __UNUSED__, void *ev
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_manager_cb_ping(void *data, int ev_type __UNUSED__, void *ev)
|
||||
{
|
||||
E_Manager *man;
|
||||
E_Border *bd;
|
||||
Ecore_X_Event_Ping *e;
|
||||
|
||||
man = data;
|
||||
e = ev;
|
||||
|
||||
if (e->win != man->root) return 1;
|
||||
|
||||
bd = e_border_find_by_client_window(e->event_win);
|
||||
if (!bd) return 1;
|
||||
|
||||
printf("PING response: %f\n", ecore_time_get() - bd->ping);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0 /* use later - maybe */
|
||||
static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev){return 1;}
|
||||
static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev){return 1;}
|
||||
|
|
Loading…
Reference in New Issue