fixes to the properties and net_supported. a bunch weren't supported. better checking at runtime to make sure everything is in the atom.

This commit is contained in:
Dana Jansens 2007-05-05 18:19:26 +00:00
parent b114ec7181
commit 3409148047
7 changed files with 76 additions and 44 deletions

View file

@ -1103,7 +1103,7 @@ static void client_get_state(ObClient *self)
self->below = TRUE;
else if (state[i] == prop_atoms.net_wm_state_demands_attention)
self->demands_attention = TRUE;
else if (state[i] == prop_atoms.ob_wm_state_undecorated)
else if (state[i] == prop_atoms.openbox_wm_state_undecorated)
self->undecorated = TRUE;
}
@ -2105,7 +2105,7 @@ static void client_change_state(ObClient *self)
if (self->demands_attention)
netstate[num++] = prop_atoms.net_wm_state_demands_attention;
if (self->undecorated)
netstate[num++] = prop_atoms.ob_wm_state_undecorated;
netstate[num++] = prop_atoms.openbox_wm_state_undecorated;
PROP_SETA32(self->window, net_wm_state, atom, netstate, num);
if (self->frame)
@ -3053,7 +3053,7 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
action = self->demands_attention ?
prop_atoms.net_wm_state_remove :
prop_atoms.net_wm_state_add;
else if (state == prop_atoms.ob_wm_state_undecorated)
else if (state == prop_atoms.openbox_wm_state_undecorated)
action = undecorated ? prop_atoms.net_wm_state_remove :
prop_atoms.net_wm_state_add;
}
@ -3083,7 +3083,7 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
self->below = TRUE;
} else if (state == prop_atoms.net_wm_state_demands_attention) {
demands_attention = TRUE;
} else if (state == prop_atoms.ob_wm_state_undecorated) {
} else if (state == prop_atoms.openbox_wm_state_undecorated) {
undecorated = TRUE;
}
@ -3110,7 +3110,7 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
self->below = FALSE;
} else if (state == prop_atoms.net_wm_state_demands_attention) {
demands_attention = FALSE;
} else if (state == prop_atoms.ob_wm_state_undecorated) {
} else if (state == prop_atoms.openbox_wm_state_undecorated) {
undecorated = FALSE;
}
}

View file

@ -570,7 +570,7 @@ static void event_handle_root(XEvent *e)
screen_set_num_desktops(d);
} else if (msgtype == prop_atoms.net_showing_desktop) {
screen_show_desktop(e->xclient.data.l[0] != 0, TRUE);
} else if (msgtype == prop_atoms.ob_control) {
} else if (msgtype == prop_atoms.openbox_control) {
if (e->xclient.data.l[0] == 1)
ob_reconfigure();
else if (e->xclient.data.l[0] == 2)

View file

@ -508,6 +508,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
vals[3] = self->size.bottom;
PROP_SETA32(self->client->window, net_frame_extents,
cardinal, vals, 4);
PROP_SETA32(self->client->window, kde_net_wm_frame_strut,
cardinal, vals, 4);
}
/* if this occurs while we are focus cycling, the indicator needs to

View file

@ -137,7 +137,7 @@ gint main(gint argc, gchar **argv)
* remote_control = 1 -> reconfigure
* remote_control = 2 -> restart */
PROP_MSG(RootWindow(ob_display, ob_screen),
ob_control, remote_control, 0, 0, 0);
openbox_control, remote_control, 0, 0, 0);
XCloseDisplay(ob_display);
exit(EXIT_SUCCESS);
}

View file

@ -64,6 +64,7 @@ void prop_startup()
CREATE(net_current_desktop, "_NET_CURRENT_DESKTOP");
CREATE(net_desktop_names, "_NET_DESKTOP_NAMES");
CREATE(net_active_window, "_NET_ACTIVE_WINDOW");
/* CREATE(net_restack_window, "_NET_RESTACK_WINDOW");*/
CREATE(net_workarea, "_NET_WORKAREA");
CREATE(net_supporting_wm_check, "_NET_SUPPORTING_WM_CHECK");
CREATE(net_desktop_layout, "_NET_DESKTOP_LAYOUT");
@ -89,6 +90,7 @@ void prop_startup()
/* CREATE(net_wm_pid, "_NET_WM_PID"); */
CREATE(net_wm_allowed_actions, "_NET_WM_ALLOWED_ACTIONS");
CREATE(net_wm_user_time, "_NET_WM_USER_TIME");
CREATE(kde_net_wm_frame_strut, "_KDE_NET_WM_FRAME_STRUT");
CREATE(net_frame_extents, "_NET_FRAME_EXTENTS");
/* CREATE(net_wm_ping, "_NET_WM_PING"); */
@ -129,7 +131,7 @@ void prop_startup()
CREATE(net_wm_action_change_desktop, "_NET_WM_ACTION_CHANGE_DESKTOP");
CREATE(net_wm_action_close, "_NET_WM_ACTION_CLOSE");
CREATE(net_wm_state_modal, "_NET_WM_STATE_MODAL");
CREATE(net_wm_state_sticky, "_NET_WM_STATE_STICKY");
/* CREATE(net_wm_state_sticky, "_NET_WM_STATE_STICKY");*/
CREATE(net_wm_state_maximized_vert, "_NET_WM_STATE_MAXIMIZED_VERT");
CREATE(net_wm_state_maximized_horz, "_NET_WM_STATE_MAXIMIZED_HORZ");
CREATE(net_wm_state_shaded, "_NET_WM_STATE_SHADED");
@ -155,13 +157,15 @@ void prop_startup()
CREATE(kde_wm_change_state, "_KDE_WM_CHANGE_STATE");
CREATE(kde_net_wm_window_type_override,"_KDE_NET_WM_WINDOW_TYPE_OVERRIDE");
/*
CREATE(rootpmapid, "_XROOTPMAP_ID");
CREATE(esetrootid, "ESETROOT_PMAP_ID");
*/
CREATE(openbox_pid, "_OPENBOX_PID");
CREATE(openbox_rc, "_OPENBOX_RC");
CREATE(ob_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
CREATE(ob_control, "_OB_CONTROL");
CREATE(openbox_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
CREATE(openbox_control, "_OB_CONTROL");
}
#include <X11/Xutil.h>

View file

@ -58,7 +58,33 @@ typedef struct Atoms {
/* NETWM atoms */
Atom net_wm_full_placement;
/* Atoms that are used inside messages - these don't go in net_supported */
Atom net_wm_moveresize_size_topleft;
Atom net_wm_moveresize_size_top;
Atom net_wm_moveresize_size_topright;
Atom net_wm_moveresize_size_right;
Atom net_wm_moveresize_size_bottomright;
Atom net_wm_moveresize_size_bottom;
Atom net_wm_moveresize_size_bottomleft;
Atom net_wm_moveresize_size_left;
Atom net_wm_moveresize_move;
Atom net_wm_moveresize_size_keyboard;
Atom net_wm_moveresize_move_keyboard;
Atom net_wm_moveresize_cancel;
Atom net_wm_state_add;
Atom net_wm_state_remove;
Atom net_wm_state_toggle;
Atom net_wm_orientation_horz;
Atom net_wm_orientation_vert;
Atom net_wm_topleft;
Atom net_wm_topright;
Atom net_wm_bottomright;
Atom net_wm_bottomleft;
/* Everything below here must go in net_supported on the root window */
/* root window properties */
Atom net_supported;
@ -70,15 +96,20 @@ typedef struct Atoms {
Atom net_current_desktop;
Atom net_desktop_names;
Atom net_active_window;
/* Atom net_restack_window;*/
Atom net_workarea;
Atom net_supporting_wm_check;
Atom net_desktop_layout;
Atom net_showing_desktop;
/* root window messages */
Atom net_close_window;
Atom net_wm_moveresize;
Atom net_moveresize_window;
/* helpful hints to apps that aren't used for anything */
Atom net_wm_full_placement;
/* startup-notification extension */
Atom net_startup_id;
@ -115,19 +146,6 @@ typedef struct Atoms {
Atom net_wm_window_type_dialog;
Atom net_wm_window_type_normal;
Atom net_wm_moveresize_size_topleft;
Atom net_wm_moveresize_size_top;
Atom net_wm_moveresize_size_topright;
Atom net_wm_moveresize_size_right;
Atom net_wm_moveresize_size_bottomright;
Atom net_wm_moveresize_size_bottom;
Atom net_wm_moveresize_size_bottomleft;
Atom net_wm_moveresize_size_left;
Atom net_wm_moveresize_move;
Atom net_wm_moveresize_size_keyboard;
Atom net_wm_moveresize_move_keyboard;
Atom net_wm_moveresize_cancel;
Atom net_wm_action_move;
Atom net_wm_action_resize;
Atom net_wm_action_minimize;
@ -139,7 +157,7 @@ typedef struct Atoms {
Atom net_wm_action_close;
Atom net_wm_state_modal;
Atom net_wm_state_sticky;
/* Atom net_wm_state_sticky;*/
Atom net_wm_state_maximized_vert;
Atom net_wm_state_maximized_horz;
Atom net_wm_state_shaded;
@ -151,31 +169,23 @@ typedef struct Atoms {
Atom net_wm_state_below;
Atom net_wm_state_demands_attention;
Atom net_wm_state_add;
Atom net_wm_state_remove;
Atom net_wm_state_toggle;
Atom net_wm_orientation_horz;
Atom net_wm_orientation_vert;
Atom net_wm_topleft;
Atom net_wm_topright;
Atom net_wm_bottomright;
Atom net_wm_bottomleft;
/* Extra atoms */
/* KDE atoms */
Atom kde_wm_change_state;
Atom kde_net_wm_frame_strut;
Atom kde_net_wm_window_type_override;
/*
Atom rootpmapid;
Atom esetrootid;
*/
/* Openbox specific atoms */
Atom openbox_wm_state_undecorated;
Atom openbox_pid;
Atom openbox_rc;
Atom ob_wm_state_undecorated;
Atom ob_control;
Atom openbox_control;
} Atoms;
Atoms prop_atoms;

View file

@ -157,6 +157,7 @@ gboolean screen_annex()
XSetWindowAttributes attrib;
pid_t pid;
gint i, num_support;
Atom *prop_atoms_start, *wm_supported_pos;
gulong *supported;
/* create the netwm support window */
@ -205,12 +206,15 @@ gboolean screen_annex()
window, screen_support_win);
/* set the _NET_SUPPORTED_ATOMS hint */
num_support = 55;
#ifdef SYNC
num_support += 2;
#endif
/* this is all the atoms after net_supported in the prop_atoms struct */
prop_atoms_start = (Atom*)&prop_atoms;
wm_supported_pos = (Atom*)&(prop_atoms.net_supported);
num_support = sizeof(prop_atoms) / sizeof(Atom) -
(wm_supported_pos - prop_atoms_start) - 1;
i = 0;
supported = g_new(gulong, num_support);
supported[i++] = prop_atoms.net_supporting_wm_check;
supported[i++] = prop_atoms.net_wm_full_placement;
supported[i++] = prop_atoms.net_current_desktop;
supported[i++] = prop_atoms.net_number_of_desktops;
@ -230,6 +234,9 @@ gboolean screen_annex()
supported[i++] = prop_atoms.net_wm_visible_icon_name;
supported[i++] = prop_atoms.net_wm_desktop;
supported[i++] = prop_atoms.net_wm_strut;
supported[i++] = prop_atoms.net_wm_strut_partial;
supported[i++] = prop_atoms.net_wm_icon;
supported[i++] = prop_atoms.net_wm_icon_geometry;
supported[i++] = prop_atoms.net_wm_window_type;
supported[i++] = prop_atoms.net_wm_window_type_desktop;
supported[i++] = prop_atoms.net_wm_window_type_dock;
@ -265,11 +272,20 @@ gboolean screen_annex()
supported[i++] = prop_atoms.net_wm_moveresize;
supported[i++] = prop_atoms.net_wm_user_time;
supported[i++] = prop_atoms.net_frame_extents;
supported[i++] = prop_atoms.net_startup_id;
#ifdef SYNC
supported[i++] = prop_atoms.net_wm_sync_request;
supported[i++] = prop_atoms.net_wm_sync_request_counter;
#endif
supported[i++] = prop_atoms.ob_wm_state_undecorated;
supported[i++] = prop_atoms.kde_wm_change_state;
supported[i++] = prop_atoms.kde_net_wm_frame_strut;
supported[i++] = prop_atoms.kde_net_wm_window_type_override;
supported[i++] = prop_atoms.openbox_wm_state_undecorated;
supported[i++] = prop_atoms.openbox_pid;
supported[i++] = prop_atoms.openbox_rc;
supported[i++] = prop_atoms.openbox_control;
g_assert(i == num_support);
PROP_SETA32(RootWindow(ob_display, ob_screen),