AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([openbox/openbox.c])
++OB_VERSION=$PACKAGE_VERSION
++AC_SUBST(OB_VERSION)
++
dnl Making releases:
-dnl OB_MICRO_VERSION += 1;
-dnl OB_INTERFACE_AGE += 1;
-dnl OB_BINARY_AGE += 1;
-dnl if any functions have been added, set OB_INTERFACE_AGE to 0.
+dnl RR_MICRO_VERSION += 1;
+dnl RR_INTERFACE_AGE += 1;
+dnl R_BINARY_AGE += 1;
+dnl if any functions have been added, set RR_INTERFACE_AGE to 0.
dnl if backwards compatibility has been broken,
-dnl set OB_BINARY_AGE and OB_INTERFACE_AGE to 0.
+dnl set RR_BINARY_AGE and RR_INTERFACE_AGE to 0.
dnl
dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
dnl
Makefile
m4/Makefile
po/Makefile.in
- render/obrender-3.0.pc
- parser/obparser-3.0.pc
+ obrender/obrender-3.5.pc
+ obt/obt-3.5.pc
+ obrender/version.h
+ obt/version.h
+ version.h
])
AC_CONFIG_COMMANDS([doc],
[test -d doc || mkdir doc])
<!--
# this is an example with comments through out. use these to make your
# own rules, but without the comments of course.
+ # you may use one or more of the name/class/role/type rules to specify
+ # windows to match
- <application name="the window's _OB_NAME property (see obxprop)"
- class="the window's _OB_CLASS property (see obxprop)"
- role="the window's _OB_ROLE property (see obxprop)"
- type="the window's _NET_WM_WINDOW_TYPE (see obxprob)..
- (if unspecified, then it is 'dialog' for child windows)
- one of: normal, dialog, splash, utility, menu, toolbar,
- dock, desktop">
- # the name or the class can be set, or both. this is used to match
- # windows when they appear. role can optionally be set as well, to
- # further restrict your matches.
+ <application name="the window's _OB_APP_NAME property (see obxprop)"
+ class="the window's _OB_APP_CLASS property (see obxprop)"
+ role="the window's _OB_APP_ROLE property (see obxprop)"
+ type="the window's _OB_APP_TYPE property (see obxprob)..
+ (if unspecified, then it is 'dialog' for child windows)">
+ # you may set only one of name/class/role/type, or you may use more than one
+ # together to restrict your matches.
# the name, class, and role use simple wildcard matching such as those
# used by a shell. you can use * to match any characters and ? to match
--- /dev/null
- CREATE_(OB_ROLE);
- CREATE_(OB_NAME);
- CREATE_(OB_CLASS);
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ obt/prop.c for the Openbox window manager
+ Copyright (c) 2006 Mikael Magnusson
+ Copyright (c) 2003-2007 Dana Jansens
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "obt/prop.h"
+#include "obt/display.h"
+
+#include <X11/Xatom.h>
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+Atom prop_atoms[OBT_PROP_NUM_ATOMS];
+gboolean prop_started = FALSE;
+
+#define CREATE_NAME(var, name) (prop_atoms[OBT_PROP_##var] = \
+ XInternAtom((obt_display), (name), FALSE))
+#define CREATE(var) CREATE_NAME(var, #var)
+#define CREATE_(var) CREATE_NAME(var, "_" #var)
+
+void obt_prop_startup(void)
+{
+ if (prop_started) return;
+ prop_started = TRUE;
+
+ g_assert(obt_display);
+
+ CREATE(CARDINAL);
+ CREATE(WINDOW);
+ CREATE(PIXMAP);
+ CREATE(ATOM);
+ CREATE(STRING);
+ CREATE_NAME(UTF8, "UTF8_STRING");
+
+ CREATE(MANAGER);
+
+ CREATE(WM_COLORMAP_WINDOWS);
+ CREATE(WM_PROTOCOLS);
+ CREATE(WM_STATE);
+ CREATE(WM_CHANGE_STATE);
+ CREATE(WM_DELETE_WINDOW);
+ CREATE(WM_TAKE_FOCUS);
+ CREATE(WM_NAME);
+ CREATE(WM_ICON_NAME);
+ CREATE(WM_CLASS);
+ CREATE(WM_WINDOW_ROLE);
+ CREATE(WM_CLIENT_MACHINE);
+ CREATE(WM_COMMAND);
+ CREATE(WM_CLIENT_LEADER);
+ CREATE(WM_TRANSIENT_FOR);
+ CREATE_(MOTIF_WM_HINTS);
+ CREATE_(MOTIF_WM_INFO);
+
+ CREATE(SM_CLIENT_ID);
+
+ CREATE_(NET_WM_FULL_PLACEMENT);
+
+ CREATE_(NET_SUPPORTED);
+ CREATE_(NET_CLIENT_LIST);
+ CREATE_(NET_CLIENT_LIST_STACKING);
+ CREATE_(NET_NUMBER_OF_DESKTOPS);
+ CREATE_(NET_DESKTOP_GEOMETRY);
+ CREATE_(NET_DESKTOP_VIEWPORT);
+ CREATE_(NET_CURRENT_DESKTOP);
+ CREATE_(NET_DESKTOP_NAMES);
+ CREATE_(NET_ACTIVE_WINDOW);
+/* CREATE_(NET_RESTACK_WINDOW);*/
+ CREATE_(NET_WORKAREA);
+ CREATE_(NET_SUPPORTING_WM_CHECK);
+ CREATE_(NET_DESKTOP_LAYOUT);
+ CREATE_(NET_SHOWING_DESKTOP);
+
+ CREATE_(NET_CLOSE_WINDOW);
+ CREATE_(NET_WM_MOVERESIZE);
+ CREATE_(NET_MOVERESIZE_WINDOW);
+ CREATE_(NET_REQUEST_FRAME_EXTENTS);
+ CREATE_(NET_RESTACK_WINDOW);
+
+ CREATE_(NET_STARTUP_ID);
+
+ CREATE_(NET_WM_NAME);
+ CREATE_(NET_WM_VISIBLE_NAME);
+ CREATE_(NET_WM_ICON_NAME);
+ CREATE_(NET_WM_VISIBLE_ICON_NAME);
+ CREATE_(NET_WM_DESKTOP);
+ CREATE_(NET_WM_WINDOW_TYPE);
+ CREATE_(NET_WM_STATE);
+ CREATE_(NET_WM_STRUT);
+ CREATE_(NET_WM_STRUT_PARTIAL);
+ CREATE_(NET_WM_ICON);
+ CREATE_(NET_WM_ICON_GEOMETRY);
+ CREATE_(NET_WM_PID);
+ CREATE_(NET_WM_ALLOWED_ACTIONS);
+ CREATE_(NET_WM_USER_TIME);
+/* CREATE_(NET_WM_USER_TIME_WINDOW); */
+ CREATE_(KDE_NET_WM_FRAME_STRUT);
+ CREATE_(NET_FRAME_EXTENTS);
+
+ CREATE_(NET_WM_PING);
+#ifdef SYNC
+ CREATE_(NET_WM_SYNC_REQUEST);
+ CREATE_(NET_WM_SYNC_REQUEST_COUNTER);
+#endif
+
+ CREATE_(NET_WM_WINDOW_TYPE_DESKTOP);
+ CREATE_(NET_WM_WINDOW_TYPE_DOCK);
+ CREATE_(NET_WM_WINDOW_TYPE_TOOLBAR);
+ CREATE_(NET_WM_WINDOW_TYPE_MENU);
+ CREATE_(NET_WM_WINDOW_TYPE_UTILITY);
+ CREATE_(NET_WM_WINDOW_TYPE_SPLASH);
+ CREATE_(NET_WM_WINDOW_TYPE_DIALOG);
+ CREATE_(NET_WM_WINDOW_TYPE_NORMAL);
+ CREATE_(NET_WM_WINDOW_TYPE_POPUP_MENU);
+
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPLEFT] = 0;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOP] = 1;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPRIGHT] = 2;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_RIGHT] = 3;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT] = 4;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOM] = 5;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT] = 6;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_LEFT] = 7;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_MOVE] = 8;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_SIZE_KEYBOARD] = 9;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_MOVE_KEYBOARD] = 10;
+ prop_atoms[OBT_PROP_NET_WM_MOVERESIZE_CANCEL] = 11;
+
+ CREATE_(NET_WM_ACTION_MOVE);
+ CREATE_(NET_WM_ACTION_RESIZE);
+ CREATE_(NET_WM_ACTION_MINIMIZE);
+ CREATE_(NET_WM_ACTION_SHADE);
+ CREATE_(NET_WM_ACTION_MAXIMIZE_HORZ);
+ CREATE_(NET_WM_ACTION_MAXIMIZE_VERT);
+ CREATE_(NET_WM_ACTION_FULLSCREEN);
+ CREATE_(NET_WM_ACTION_CHANGE_DESKTOP);
+ CREATE_(NET_WM_ACTION_CLOSE);
+ CREATE_(NET_WM_ACTION_ABOVE);
+ CREATE_(NET_WM_ACTION_BELOW);
+
+ CREATE_(NET_WM_STATE_MODAL);
+/* CREATE_(NET_WM_STATE_STICKY);*/
+ CREATE_(NET_WM_STATE_MAXIMIZED_VERT);
+ CREATE_(NET_WM_STATE_MAXIMIZED_HORZ);
+ CREATE_(NET_WM_STATE_SHADED);
+ CREATE_(NET_WM_STATE_SKIP_TASKBAR);
+ CREATE_(NET_WM_STATE_SKIP_PAGER);
+ CREATE_(NET_WM_STATE_HIDDEN);
+ CREATE_(NET_WM_STATE_FULLSCREEN);
+ CREATE_(NET_WM_STATE_ABOVE);
+ CREATE_(NET_WM_STATE_BELOW);
+ CREATE_(NET_WM_STATE_DEMANDS_ATTENTION);
+
+ prop_atoms[OBT_PROP_NET_WM_STATE_ADD] = 1;
+ prop_atoms[OBT_PROP_NET_WM_STATE_REMOVE] = 0;
+ prop_atoms[OBT_PROP_NET_WM_STATE_TOGGLE] = 2;
+
+ prop_atoms[OBT_PROP_NET_WM_ORIENTATION_HORZ] = 0;
+ prop_atoms[OBT_PROP_NET_WM_ORIENTATION_VERT] = 1;
+ prop_atoms[OBT_PROP_NET_WM_TOPLEFT] = 0;
+ prop_atoms[OBT_PROP_NET_WM_TOPRIGHT] = 1;
+ prop_atoms[OBT_PROP_NET_WM_BOTTOMRIGHT] = 2;
+ prop_atoms[OBT_PROP_NET_WM_BOTTOMLEFT] = 3;
+
+ CREATE_(KDE_WM_CHANGE_STATE);
+ CREATE_(KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
+
+/*
+ CREATE_NAME(ROOTPMAPId, "_XROOTPMAP_ID");
+ CREATE_NAME(ESETROOTId, "ESETROOT_PMAP_ID");
+*/
+
+ CREATE_(OPENBOX_PID);
+ CREATE_(OB_THEME);
+ CREATE_(OB_CONFIG_FILE);
+ CREATE_(OB_WM_ACTION_UNDECORATE);
+ CREATE_(OB_WM_STATE_UNDECORATED);
+ CREATE_(OB_CONTROL);
++ CREATE_(OB_VERSION);
++ CREATE_(OB_APP_ROLE);
++ CREATE_(OB_APP_NAME);
++ CREATE_(OB_APP_CLASS);
++ CREATE_(OB_APP_TYPE);
+}
+
+Atom obt_prop_atom(ObtPropAtom a)
+{
+ g_assert(prop_started);
+ g_assert(a < OBT_PROP_NUM_ATOMS);
+ return prop_atoms[a];
+}
+
+static gboolean get_prealloc(Window win, Atom prop, Atom type, gint size,
+ guchar *data, gulong num)
+{
+ gboolean ret = FALSE;
+ gint res;
+ guchar *xdata = NULL;
+ Atom ret_type;
+ gint ret_size;
+ gulong ret_items, bytes_left;
+ glong num32 = 32 / size * num; /* num in 32-bit elements */
+
+ res = XGetWindowProperty(obt_display, win, prop, 0l, num32,
+ FALSE, type, &ret_type, &ret_size,
+ &ret_items, &bytes_left, &xdata);
+ if (res == Success && ret_items && xdata) {
+ if (ret_size == size && ret_items >= num) {
+ guint i;
+ for (i = 0; i < num; ++i)
+ switch (size) {
+ case 8:
+ data[i] = xdata[i];
+ break;
+ case 16:
+ ((guint16*)data)[i] = ((gushort*)xdata)[i];
+ break;
+ case 32:
+ ((guint32*)data)[i] = ((gulong*)xdata)[i];
+ break;
+ default:
+ g_assert_not_reached(); /* unhandled size */
+ }
+ ret = TRUE;
+ }
+ XFree(xdata);
+ }
+ return ret;
+}
+
+static gboolean get_all(Window win, Atom prop, Atom type, gint size,
+ guchar **data, guint *num)
+{
+ gboolean ret = FALSE;
+ gint res;
+ guchar *xdata = NULL;
+ Atom ret_type;
+ gint ret_size;
+ gulong ret_items, bytes_left;
+
+ res = XGetWindowProperty(obt_display, win, prop, 0l, G_MAXLONG,
+ FALSE, type, &ret_type, &ret_size,
+ &ret_items, &bytes_left, &xdata);
+ if (res == Success) {
+ if (ret_size == size && ret_items > 0) {
+ guint i;
+
+ *data = g_malloc(ret_items * (size / 8));
+ for (i = 0; i < ret_items; ++i)
+ switch (size) {
+ case 8:
+ (*data)[i] = xdata[i];
+ break;
+ case 16:
+ ((guint16*)*data)[i] = ((gushort*)xdata)[i];
+ break;
+ case 32:
+ ((guint32*)*data)[i] = ((gulong*)xdata)[i];
+ break;
+ default:
+ g_assert_not_reached(); /* unhandled size */
+ }
+ *num = ret_items;
+ ret = TRUE;
+ }
+ XFree(xdata);
+ }
+ return ret;
+}
+
+static gboolean get_stringlist(Window win, Atom prop, gchar ***list, gint *nstr)
+{
+ XTextProperty tprop;
+ gboolean ret = FALSE;
+
+ if (XGetTextProperty(obt_display, win, &tprop, prop) && tprop.nitems) {
+ if (XTextPropertyToStringList(&tprop, list, nstr))
+ ret = TRUE;
+ XFree(tprop.value);
+ }
+ return ret;
+}
+
+gboolean obt_prop_get32(Window win, Atom prop, Atom type, guint32 *ret)
+{
+ return get_prealloc(win, prop, type, 32, (guchar*)ret, 1);
+}
+
+gboolean obt_prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
+ guint *nret)
+{
+ return get_all(win, prop, type, 32, (guchar**)ret, nret);
+}
+
+gboolean obt_prop_get_string_locale(Window win, Atom prop, gchar **ret)
+{
+ gchar **list;
+ gint nstr;
+ gchar *s;
+
+ if (get_stringlist(win, prop, &list, &nstr) && nstr) {
+ s = g_locale_to_utf8(list[0], -1, NULL, NULL, NULL);
+ XFreeStringList(list);
+ if (s) {
+ *ret = s;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+gboolean obt_prop_get_strings_locale(Window win, Atom prop, gchar ***ret)
+{
+ GSList *strs = NULL, *it;
+ gchar *raw, *p;
+ guint num, i, count = 0;
+
+ if (get_all(win, prop, OBT_PROP_ATOM(STRING), 8,
+ (guchar**)&raw, &num))
+ {
+ p = raw;
+ while (p < raw + num) {
+ ++count;
+ strs = g_slist_append(strs, p);
+ p += strlen(p) + 1; /* next string */
+ }
+
+ *ret = g_new0(gchar*, count + 1);
+ (*ret)[count] = NULL; /* null terminated list */
+
+ for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
+ (*ret)[i] = g_locale_to_utf8(it->data, -1, NULL, NULL, NULL);
+ /* make sure translation did not fail */
+ if (!(*ret)[i])
+ (*ret)[i] = g_strdup("");
+ }
+ g_free(raw);
+ g_slist_free(strs);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gboolean obt_prop_get_string_utf8(Window win, Atom prop, gchar **ret)
+{
+ gchar *raw;
+ gchar *str;
+ guint num;
+
+ if (get_all(win, prop, OBT_PROP_ATOM(UTF8), 8,
+ (guchar**)&raw, &num))
+ {
+ str = g_strndup(raw, num); /* grab the first string from the list */
+ g_free(raw);
+ if (g_utf8_validate(str, -1, NULL)) {
+ *ret = str;
+ return TRUE;
+ }
+ g_free(str);
+ }
+ return FALSE;
+}
+
+gboolean obt_prop_get_strings_utf8(Window win, Atom prop, gchar ***ret)
+{
+ GSList *strs = NULL, *it;
+ gchar *raw, *p;
+ guint num, i, count = 0;
+
+ if (get_all(win, prop, OBT_PROP_ATOM(UTF8), 8,
+ (guchar**)&raw, &num))
+ {
+ p = raw;
+ while (p < raw + num) {
+ ++count;
+ strs = g_slist_append(strs, p);
+ p += strlen(p) + 1; /* next string */
+ }
+
+ *ret = g_new0(gchar*, count + 1);
+
+ for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
+ if (g_utf8_validate(it->data, -1, NULL))
+ (*ret)[i] = g_strdup(it->data);
+ else
+ (*ret)[i] = g_strdup("");
+ }
+ g_free(raw);
+ g_slist_free(strs);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void obt_prop_set32(Window win, Atom prop, Atom type, gulong val)
+{
+ XChangeProperty(obt_display, win, prop, type, 32, PropModeReplace,
+ (guchar*)&val, 1);
+}
+
+void obt_prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
+ guint num)
+{
+ XChangeProperty(obt_display, win, prop, type, 32, PropModeReplace,
+ (guchar*)val, num);
+}
+
+void obt_prop_set_string_locale(Window win, Atom prop, const gchar *val)
+{
+ gchar const *s[2] = { val, NULL };
+ obt_prop_set_strings_locale(win, prop, s);
+}
+
+void obt_prop_set_strings_locale(Window win, Atom prop, const gchar **strs)
+{
+ gint i, count;
+ gchar **lstrs;
+ XTextProperty tprop;
+
+ /* count the strings in strs, and convert them to the locale format */
+ for (count = 0; strs[count]; ++count);
+ lstrs = g_new0(char*, count);
+ for (i = 0; i < count; ++i) {
+ lstrs[i] = g_locale_from_utf8(strs[i], -1, NULL, NULL, NULL);
+ if (!lstrs[i]) {
+ lstrs[i] = g_strdup(""); /* make it an empty string */
+ g_warning("Unable to translate string '%s' from UTF8 to locale "
+ "format", strs[i]);
+ }
+ }
+
+
+ XStringListToTextProperty(lstrs, count, &tprop);
+ XSetTextProperty(obt_display, win, &tprop, prop);
+ XFree(tprop.value);
+}
+
+void obt_prop_set_string_utf8(Window win, Atom prop, const gchar *val)
+{
+ XChangeProperty(obt_display, win, prop, OBT_PROP_ATOM(UTF8), 8,
+ PropModeReplace, (const guchar*)val, strlen(val));
+}
+
+void obt_prop_set_strings_utf8(Window win, Atom prop, const gchar **strs)
+{
+ GString *str;
+ gchar const **s;
+
+ str = g_string_sized_new(0);
+ for (s = strs; *s; ++s) {
+ str = g_string_append(str, *s);
+ str = g_string_append_c(str, '\0');
+ }
+ XChangeProperty(obt_display, win, prop, obt_prop_atom(OBT_PROP_UTF8), 8,
+ PropModeReplace, (guchar*)str->str, str->len);
+ g_string_free(str, TRUE);
+}
+
+void obt_prop_erase(Window win, Atom prop)
+{
+ XDeleteProperty(obt_display, win, prop);
+}
+
+void obt_prop_message(gint screen, Window about, Atom messagetype,
+ glong data0, glong data1, glong data2, glong data3,
+ glong data4, glong mask)
+{
+ obt_prop_message_to(obt_root(screen), about, messagetype,
+ data0, data1, data2, data3, data4, mask);
+}
+
+void obt_prop_message_to(Window to, Window about,
+ Atom messagetype,
+ glong data0, glong data1, glong data2, glong data3,
+ glong data4, glong mask)
+{
+ XEvent ce;
+ ce.xclient.type = ClientMessage;
+ ce.xclient.message_type = messagetype;
+ ce.xclient.display = obt_display;
+ ce.xclient.window = about;
+ ce.xclient.format = 32;
+ ce.xclient.data.l[0] = data0;
+ ce.xclient.data.l[1] = data1;
+ ce.xclient.data.l[2] = data2;
+ ce.xclient.data.l[3] = data3;
+ ce.xclient.data.l[4] = data4;
+ XSendEvent(obt_display, to, FALSE, mask, &ce);
+}
--- /dev/null
- OBT_PROP_OB_ROLE,
- OBT_PROP_OB_NAME,
- OBT_PROP_OB_CLASS,
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ obt/prop.h for the Openbox window manager
+ Copyright (c) 2006 Mikael Magnusson
+ Copyright (c) 2003-2007 Dana Jansens
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#ifndef __obt_prop_h
+#define __obt_prop_h
+
+#include <X11/Xlib.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ /* types */
+ OBT_PROP_CARDINAL, /*!< The atom which represents the Cardinal data type */
+ OBT_PROP_WINDOW, /*!< The atom which represents window ids */
+ OBT_PROP_PIXMAP, /*!< The atom which represents pixmap ids */
+ OBT_PROP_ATOM, /*!< The atom which represents atom values */
+ OBT_PROP_STRING, /*!< The atom which represents ascii strings */
+ OBT_PROP_UTF8, /*!< The atom which represents utf8-encoded strings */
+
+ /* selection stuff */
+ OBT_PROP_MANAGER,
+
+ /* window hints */
+ OBT_PROP_WM_COLORMAP_WINDOWS,
+ OBT_PROP_WM_PROTOCOLS,
+ OBT_PROP_WM_STATE,
+ OBT_PROP_WM_DELETE_WINDOW,
+ OBT_PROP_WM_TAKE_FOCUS,
+ OBT_PROP_WM_CHANGE_STATE,
+ OBT_PROP_WM_NAME,
+ OBT_PROP_WM_ICON_NAME,
+ OBT_PROP_WM_CLASS,
+ OBT_PROP_WM_WINDOW_ROLE,
+ OBT_PROP_WM_CLIENT_MACHINE,
+ OBT_PROP_WM_COMMAND,
+ OBT_PROP_WM_CLIENT_LEADER,
+ OBT_PROP_WM_TRANSIENT_FOR,
+ OBT_PROP_MOTIF_WM_HINTS,
+ OBT_PROP_MOTIF_WM_INFO,
+
+ /* SM atoms */
+ OBT_PROP_SM_CLIENT_ID,
+
+ /* NETWM atoms */
+
+ /* Atoms that are used inside messages - these don't go in net_supported */
+
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPLEFT,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOP,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPRIGHT,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_RIGHT,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOM,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_LEFT,
+ OBT_PROP_NET_WM_MOVERESIZE_MOVE,
+ OBT_PROP_NET_WM_MOVERESIZE_SIZE_KEYBOARD,
+ OBT_PROP_NET_WM_MOVERESIZE_MOVE_KEYBOARD,
+ OBT_PROP_NET_WM_MOVERESIZE_CANCEL,
+
+ OBT_PROP_NET_WM_STATE_ADD,
+ OBT_PROP_NET_WM_STATE_REMOVE,
+ OBT_PROP_NET_WM_STATE_TOGGLE,
+
+ OBT_PROP_NET_WM_ORIENTATION_HORZ,
+ OBT_PROP_NET_WM_ORIENTATION_VERT,
+ OBT_PROP_NET_WM_TOPLEFT,
+ OBT_PROP_NET_WM_TOPRIGHT,
+ OBT_PROP_NET_WM_BOTTOMRIGHT,
+ OBT_PROP_NET_WM_BOTTOMLEFT,
+
+ OBT_PROP_NET_WM_WINDOW_TYPE_POPUP_MENU,
+
+ OBT_PROP_PRIVATE_PADDING1,
+ OBT_PROP_PRIVATE_PADDING2,
+ OBT_PROP_PRIVATE_PADDING3,
+ OBT_PROP_PRIVATE_PADDING4,
+ OBT_PROP_PRIVATE_PADDING5,
+ OBT_PROP_PRIVATE_PADDING6,
+ OBT_PROP_PRIVATE_PADDING7,
+ OBT_PROP_PRIVATE_PADDING8,
+ OBT_PROP_PRIVATE_PADDING9,
+ OBT_PROP_PRIVATE_PADDING10,
+ OBT_PROP_PRIVATE_PADDING11,
+ OBT_PROP_PRIVATE_PADDING12,
+
+ /* Everything below here must go in net_supported on the root window */
+
+ /* root window properties */
+ OBT_PROP_NET_SUPPORTED,
+ OBT_PROP_NET_CLIENT_LIST,
+ OBT_PROP_NET_CLIENT_LIST_STACKING,
+ OBT_PROP_NET_NUMBER_OF_DESKTOPS,
+ OBT_PROP_NET_DESKTOP_GEOMETRY,
+ OBT_PROP_NET_DESKTOP_VIEWPORT,
+ OBT_PROP_NET_CURRENT_DESKTOP,
+ OBT_PROP_NET_DESKTOP_NAMES,
+ OBT_PROP_NET_ACTIVE_WINDOW,
+/* Atom net_restack_window;*/
+ OBT_PROP_NET_WORKAREA,
+ OBT_PROP_NET_SUPPORTING_WM_CHECK,
+ OBT_PROP_NET_DESKTOP_LAYOUT,
+ OBT_PROP_NET_SHOWING_DESKTOP,
+
+ /* root window messages */
+ OBT_PROP_NET_CLOSE_WINDOW,
+ OBT_PROP_NET_WM_MOVERESIZE,
+ OBT_PROP_NET_MOVERESIZE_WINDOW,
+ OBT_PROP_NET_REQUEST_FRAME_EXTENTS,
+ OBT_PROP_NET_RESTACK_WINDOW,
+
+ /* helpful hints to apps that aren't used for anything */
+ OBT_PROP_NET_WM_FULL_PLACEMENT,
+
+ /* startup-notification extension */
+ OBT_PROP_NET_STARTUP_ID,
+
+ /* application window properties */
+ OBT_PROP_NET_WM_NAME,
+ OBT_PROP_NET_WM_VISIBLE_NAME,
+ OBT_PROP_NET_WM_ICON_NAME,
+ OBT_PROP_NET_WM_VISIBLE_ICON_NAME,
+ OBT_PROP_NET_WM_DESKTOP,
+ OBT_PROP_NET_WM_WINDOW_TYPE,
+ OBT_PROP_NET_WM_STATE,
+ OBT_PROP_NET_WM_STRUT,
+ OBT_PROP_NET_WM_STRUT_PARTIAL,
+ OBT_PROP_NET_WM_ICON,
+ OBT_PROP_NET_WM_ICON_GEOMETRY,
+ OBT_PROP_NET_WM_PID,
+ OBT_PROP_NET_WM_ALLOWED_ACTIONS,
+ OBT_PROP_NET_WM_USER_TIME,
+/* OBT_PROP_NET_WM_USER_TIME_WINDOW, */
+ OBT_PROP_NET_FRAME_EXTENTS,
+
+ /* application protocols */
+ OBT_PROP_NET_WM_PING,
+#ifdef SYNC
+ OBT_PROP_NET_WM_SYNC_REQUEST,
+ OBT_PROP_NET_WM_SYNC_REQUEST_COUNTER,
+#endif
+
+ OBT_PROP_NET_WM_WINDOW_TYPE_DESKTOP,
+ OBT_PROP_NET_WM_WINDOW_TYPE_DOCK,
+ OBT_PROP_NET_WM_WINDOW_TYPE_TOOLBAR,
+ OBT_PROP_NET_WM_WINDOW_TYPE_MENU,
+ OBT_PROP_NET_WM_WINDOW_TYPE_UTILITY,
+ OBT_PROP_NET_WM_WINDOW_TYPE_SPLASH,
+ OBT_PROP_NET_WM_WINDOW_TYPE_DIALOG,
+ OBT_PROP_NET_WM_WINDOW_TYPE_NORMAL,
+
+ OBT_PROP_NET_WM_ACTION_MOVE,
+ OBT_PROP_NET_WM_ACTION_RESIZE,
+ OBT_PROP_NET_WM_ACTION_MINIMIZE,
+ OBT_PROP_NET_WM_ACTION_SHADE,
+/* OBT_PROP_NET_WM_ACTION_STICK,*/
+ OBT_PROP_NET_WM_ACTION_MAXIMIZE_HORZ,
+ OBT_PROP_NET_WM_ACTION_MAXIMIZE_VERT,
+ OBT_PROP_NET_WM_ACTION_FULLSCREEN,
+ OBT_PROP_NET_WM_ACTION_CHANGE_DESKTOP,
+ OBT_PROP_NET_WM_ACTION_CLOSE,
+ OBT_PROP_NET_WM_ACTION_ABOVE,
+ OBT_PROP_NET_WM_ACTION_BELOW,
+
+ OBT_PROP_NET_WM_STATE_MODAL,
+/* OBT_PROP_NET_WM_STATE_STICKY,*/
+ OBT_PROP_NET_WM_STATE_MAXIMIZED_VERT,
+ OBT_PROP_NET_WM_STATE_MAXIMIZED_HORZ,
+ OBT_PROP_NET_WM_STATE_SHADED,
+ OBT_PROP_NET_WM_STATE_SKIP_TASKBAR,
+ OBT_PROP_NET_WM_STATE_SKIP_PAGER,
+ OBT_PROP_NET_WM_STATE_HIDDEN,
+ OBT_PROP_NET_WM_STATE_FULLSCREEN,
+ OBT_PROP_NET_WM_STATE_ABOVE,
+ OBT_PROP_NET_WM_STATE_BELOW,
+ OBT_PROP_NET_WM_STATE_DEMANDS_ATTENTION,
+
+ /* KDE atoms */
+
+ OBT_PROP_KDE_WM_CHANGE_STATE,
+ OBT_PROP_KDE_NET_WM_FRAME_STRUT,
+ OBT_PROP_KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
+
+/*
+ OBT_PROP_ROOTPMAPID,
+ OBT_PROP_ESETROOTID,
+*/
+
+ /* Openbox specific atoms */
+
+ OBT_PROP_OB_WM_ACTION_UNDECORATE,
+ OBT_PROP_OB_WM_STATE_UNDECORATED,
+ OBT_PROP_OPENBOX_PID, /* this is depreecated in favour of ob_control */
+ OBT_PROP_OB_THEME,
+ OBT_PROP_OB_CONFIG_FILE,
+ OBT_PROP_OB_CONTROL,
++ OBT_PROP_OB_VERSION,
++ OBT_PROP_OB_APP_ROLE,
++ OBT_PROP_OB_APP_NAME,
++ OBT_PROP_OB_APP_CLASS,
++ OBT_PROP_OB_APP_TYPE,
+
+ OBT_PROP_NUM_ATOMS
+} ObtPropAtom;
+
+Atom obt_prop_atom(ObtPropAtom a);
+
+gboolean obt_prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
+gboolean obt_prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
+ guint *nret);
+gboolean obt_prop_get_string_locale(Window win, Atom prop, gchar **ret);
+gboolean obt_prop_get_string_utf8(Window win, Atom prop, gchar **ret);
+gboolean obt_prop_get_strings_locale(Window win, Atom prop, gchar ***ret);
+gboolean obt_prop_get_strings_utf8(Window win, Atom prop, gchar ***ret);
+
+void obt_prop_set32(Window win, Atom prop, Atom type, gulong val);
+void obt_prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
+ guint num);
+void obt_prop_set_string_locale(Window win, Atom prop, const gchar *val);
+void obt_prop_set_string_utf8(Window win, Atom prop, const gchar *val);
+void obt_prop_set_strings_locale(Window win, Atom prop, const gchar **strs);
+void obt_prop_set_strings_utf8(Window win, Atom prop, const gchar **strs);
+
+void obt_prop_erase(Window win, Atom prop);
+
+void obt_prop_message(gint screen, Window about, Atom messagetype,
+ glong data0, glong data1, glong data2, glong data3,
+ glong data4, glong mask);
+void obt_prop_message_to(Window to, Window about, Atom messagetype,
+ glong data0, glong data1, glong data2, glong data3,
+ glong data4, glong mask);
+
+#define OBT_PROP_ATOM(prop) obt_prop_atom(OBT_PROP_##prop)
+
+#define OBT_PROP_GET32(win, prop, type, ret) \
+ (obt_prop_get32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), ret))
+#define OBT_PROP_GETA32(win, prop, type, ret, nret) \
+ (obt_prop_get_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
+ ret, nret))
+#define OBT_PROP_GETS(win, prop, type, ret) \
+ (obt_prop_get_string_##type(win, OBT_PROP_ATOM(prop), ret))
+#define OBT_PROP_GETSS(win, prop, type, ret) \
+ (obt_prop_get_strings_##type(win, OBT_PROP_ATOM(prop), ret))
+
+#define OBT_PROP_SET32(win, prop, type, val) \
+ (obt_prop_set32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), val))
+#define OBT_PROP_SETA32(win, prop, type, val, num) \
+ (obt_prop_set_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
+ val, num))
+#define OBT_PROP_SETS(win, prop, type, val) \
+ (obt_prop_set_string_##type(win, OBT_PROP_ATOM(prop), val))
+#define OBT_PROP_SETSS(win, prop, type, strs) \
+ (obt_prop_set_strings_##type(win, OBT_PROP_ATOM(prop), strs))
+
+#define OBT_PROP_ERASE(win, prop) (obt_prop_erase(win, OBT_PROP_ATOM(prop)))
+
+#define OBT_PROP_MSG(screen, about, msgtype, data0, data1, data2, data3, \
+ data4) \
+ (obt_prop_message(screen, about, OBT_PROP_ATOM(msgtype), \
+ data0, data1, data2, data3, data4, \
+ SubstructureNotifyMask | SubstructureRedirectMask))
+
+#define OBT_PROP_MSG_TO(to, about, msgtype, data0, data1, data2, data3, \
+ data4, mask) \
+ (obt_prop_message_to(to, about, OBT_PROP_ATOM(msgtype), \
+ data0, data1, data2, data3, data4, mask))
+
+G_END_DECLS
+
+#endif /* __obt_prop_h */
/* create the ObClient struct, and populate it from the hints on the
window */
self = g_new0(ObClient, 1);
- self->obwin.type = Window_Client;
+ self->obwin.type = OB_WINDOW_CLASS_CLIENT;
self->window = window;
self->prompt = prompt;
+ self->managed = TRUE;
/* non-zero defaults */
self->wmstate = WithdrawnState; /* make sure it gets updated first time */
}
}
- /*! Save the session IDs as seen by Openbox when the window mapped, so that
- users can still access them later if the app changes them */
- static void client_save_session_ids(ObClient *self)
+ /*! Save the properties used for app matching rules, as seen by Openbox when
+ the window mapped, so that users can still access them later if the app
+ changes them */
+ static void client_save_app_rule_values(ObClient *self)
{
- OBT_PROP_SETS(self->window, OB_ROLE, utf8, self->role);
- OBT_PROP_SETS(self->window, OB_NAME, utf8, self->name);
- OBT_PROP_SETS(self->window, OB_CLASS, utf8, self->class);
+ const gchar *type;
+
- PROP_SETS(self->window, ob_app_role, self->role);
- PROP_SETS(self->window, ob_app_name, self->name);
- PROP_SETS(self->window, ob_app_class, self->class);
++ OBT_PROP_SETS(self->window, OB_APP_ROLE, utf8, self->role);
++ OBT_PROP_SETS(self->window, OB_APP_NAME, utf8, self->name);
++ OBT_PROP_SETS(self->window, OB_APP_CLASS, utf8, self->class);
+
+ switch (self->type) {
+ case OB_CLIENT_TYPE_NORMAL:
+ type = "normal"; break;
+ case OB_CLIENT_TYPE_DIALOG:
+ type = "dialog"; break;
+ case OB_CLIENT_TYPE_UTILITY:
+ type = "utility"; break;
+ case OB_CLIENT_TYPE_MENU:
+ type = "menu"; break;
+ case OB_CLIENT_TYPE_TOOLBAR:
+ type = "toolbar"; break;
+ case OB_CLIENT_TYPE_SPLASH:
+ type = "splash"; break;
+ case OB_CLIENT_TYPE_DESKTOP:
+ type = "desktop"; break;
+ case OB_CLIENT_TYPE_DOCK:
+ type = "dock"; break;
+ }
- PROP_SETS(self->window, ob_app_type, type);
++ OBT_PROP_SETS(self->window, OB_APP_TYPE, utf8, type);
}
static void client_change_wm_state(ObClient *self)
return FALSE;
}
-static gboolean event_handle_menu_keyboard(XEvent *ev)
+static gboolean event_handle_menu_input(XEvent *ev)
{
- guint keycode, state;
- gunichar unikey;
- ObMenuFrame *frame;
gboolean ret = FALSE;
- keycode = ev->xkey.keycode;
- state = ev->xkey.state;
- unikey = translate_unichar(keycode);
+ if (ev->type == ButtonRelease || ev->type == ButtonPress) {
+ ObMenuEntryFrame *e;
- frame = find_active_or_last_menu();
- if (frame == NULL)
- g_assert_not_reached(); /* there is no active menu */
+ if (menu_hide_delay_reached() &&
+ (ev->xbutton.button < 4 || ev->xbutton.button > 5))
+ {
+ if ((e = menu_entry_frame_under(ev->xbutton.x_root,
+ ev->xbutton.y_root)))
+ {
+ if (ev->type == ButtonPress && e->frame->child)
+ menu_frame_select(e->frame->child, NULL, TRUE);
+ menu_frame_select(e->frame, e, TRUE);
+ if (ev->type == ButtonRelease)
+ menu_entry_frame_execute(e, ev->xbutton.state);
+ }
+ else if (ev->type == ButtonRelease)
+ menu_frame_hide_all();
+ }
+ ret = TRUE;
+ }
+ else if (ev->type == MotionNotify) {
+ ObMenuFrame *f;
+ ObMenuEntryFrame *e;
+
+ if ((e = menu_entry_frame_under(ev->xmotion.x_root,
+ ev->xmotion.y_root)))
+ if (!(f = find_active_menu()) ||
+ f == e->frame ||
+ f->parent == e->frame ||
+ f->child == e->frame)
+ menu_frame_select(e->frame, e, FALSE);
+ }
+ else if (ev->type == KeyPress || ev->type == KeyRelease) {
+ guint keycode, state;
+ gunichar unikey;
+ ObMenuFrame *frame;
- /* Allow control while going thru the menu */
- else if (ev->type == KeyPress && (state & ~ControlMask) == 0) {
- frame->got_press = TRUE;
+ keycode = ev->xkey.keycode;
+ state = ev->xkey.state;
+ unikey = obt_keyboard_keycode_to_unichar(keycode);
- if (ob_keycode_match(keycode, OB_KEY_ESCAPE)) {
- menu_frame_hide_all();
- ret = TRUE;
- }
+ frame = find_active_or_last_menu();
+ if (frame == NULL)
+ g_assert_not_reached(); /* there is no active menu */
- else if (ob_keycode_match(keycode, OB_KEY_LEFT)) {
- /* Left goes to the parent menu */
- if (frame->parent) {
- /* remove focus from the child */
- menu_frame_select(frame, NULL, TRUE);
- /* and put it in the parent */
- menu_frame_select(frame->parent, frame->parent->selected,
- TRUE);
+ /* Allow control while going thru the menu */
+ else if (ev->type == KeyPress && (state & ~ControlMask) == 0) {
+ frame->got_press = TRUE;
+
+ if (ob_keycode_match(keycode, OB_KEY_ESCAPE)) {
+ menu_frame_hide_all();
+ ret = TRUE;
}
- ret = TRUE;
- }
- else if (ob_keycode_match(keycode, OB_KEY_RIGHT)) {
- /* Right goes to the selected submenu */
- if (frame->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) {
- /* make sure it is visible */
- menu_frame_select(frame, frame->selected, TRUE);
- menu_frame_select_next(frame->child);
+ else if (ob_keycode_match(keycode, OB_KEY_LEFT)) {
+ /* Left goes to the parent menu */
+ if (frame->parent) {
+ /* remove focus from the child */
+ menu_frame_select(frame, NULL, TRUE);
+ /* and put it in the parent */
+ menu_frame_select(frame->parent, frame->parent->selected,
+ TRUE);
+ }
+ ret = TRUE;
}
- ret = TRUE;
- }
- else if (ob_keycode_match(keycode, OB_KEY_UP)) {
- menu_frame_select_previous(frame);
- ret = TRUE;
- }
+ else if (ob_keycode_match(keycode, OB_KEY_RIGHT)) {
+ /* Right goes to the selected submenu */
- if (frame->child) menu_frame_select_next(frame->child);
++ if (frame->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)
++ {
++ /* make sure it is visible */
++ menu_frame_select(frame, frame->selected, TRUE);
++ menu_frame_select_next(frame->child);
++ }
+ ret = TRUE;
+ }
- else if (ob_keycode_match(keycode, OB_KEY_DOWN)) {
- menu_frame_select_next(frame);
- ret = TRUE;
- }
+ else if (ob_keycode_match(keycode, OB_KEY_UP)) {
+ menu_frame_select_previous(frame);
+ ret = TRUE;
+ }
- else if (ob_keycode_match(keycode, OB_KEY_HOME)) {
- menu_frame_select_first(frame);
- ret = TRUE;
- }
+ else if (ob_keycode_match(keycode, OB_KEY_DOWN)) {
+ menu_frame_select_next(frame);
+ ret = TRUE;
+ }
+
- else if (ob_keycode_match(keycode, OB_KEY_END)) {
- menu_frame_select_last(frame);
- ret = TRUE;
++ else if (ob_keycode_match(keycode, OB_KEY_HOME)) {
++ menu_frame_select_first(frame);
++ ret = TRUE;
++ }
++
++ else if (ob_keycode_match(keycode, OB_KEY_END)) {
++ menu_frame_select_last(frame);
++ ret = TRUE;
++ }
}
- }
- /* Use KeyRelease events for running things so that the key release doesn't
- get sent to the focused application.
+ /* Use KeyRelease events for running things so that the key release
+ doesn't get sent to the focused application.
- Allow ControlMask only, and don't bother if the menu is empty */
- else if (ev->type == KeyRelease && (state & ~ControlMask) == 0 &&
- frame->entries && frame->got_press)
- {
- if (ob_keycode_match(keycode, OB_KEY_RETURN)) {
- /* Enter runs the active item or goes into the submenu.
- Control-Enter runs it without closing the menu. */
- if (frame->child)
- menu_frame_select_next(frame->child);
- else if (frame->selected)
- menu_entry_frame_execute(frame->selected, state);
-
- ret = TRUE;
- }
+ Allow ControlMask only, and don't bother if the menu is empty */
+ else if (ev->type == KeyRelease && (state & ~ControlMask) == 0 &&
+ frame->entries && frame->got_press)
+ {
+ if (ob_keycode_match(keycode, OB_KEY_RETURN)) {
+ /* Enter runs the active item or goes into the submenu.
+ Control-Enter runs it without closing the menu. */
+ if (frame->child)
+ menu_frame_select_next(frame->child);
+ else if (frame->selected)
+ menu_entry_frame_execute(frame->selected, state);
- /* keyboard accelerator shortcuts. (if it was a valid key) */
- else if (unikey != 0) {
- GList *start;
- GList *it;
- ObMenuEntryFrame *found = NULL;
- guint num_found = 0;
-
- /* start after the selected one */
- start = frame->entries;
- if (frame->selected) {
- for (it = start; frame->selected != it->data;
- it = g_list_next(it))
- g_assert(it != NULL); /* nothing was selected? */
- /* next with wraparound */
- start = g_list_next(it);
- if (start == NULL) start = frame->entries;
+ ret = TRUE;
}
- it = start;
- do {
- ObMenuEntryFrame *e = it->data;
- gunichar entrykey = 0;
+ /* keyboard accelerator shortcuts. (if it was a valid key) */
+ else if (unikey != 0) {
+ GList *start;
+ GList *it;
+ ObMenuEntryFrame *found = NULL;
+ guint num_found = 0;
+
+ /* start after the selected one */
+ start = frame->entries;
+ if (frame->selected) {
+ for (it = start; frame->selected != it->data;
+ it = g_list_next(it))
+ g_assert(it != NULL); /* nothing was selected? */
+ /* next with wraparound */
+ start = g_list_next(it);
+ if (start == NULL) start = frame->entries;
+ }
- if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL)
- entrykey = e->entry->data.normal.shortcut;
- else if (e->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)
- entrykey = e->entry->data.submenu.submenu->shortcut;
+ it = start;
+ do {
+ ObMenuEntryFrame *e = it->data;
+ gunichar entrykey = 0;
- if (unikey == entrykey) {
- if (found == NULL) found = e;
- ++num_found;
- }
+ if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL)
+ entrykey = e->entry->data.normal.shortcut;
+ else if (e->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)
+ entrykey = e->entry->data.submenu.submenu->shortcut;
- /* next with wraparound */
- it = g_list_next(it);
- if (it == NULL) it = frame->entries;
- } while (it != start);
+ if (unikey == entrykey) {
+ if (found == NULL) found = e;
+ ++num_found;
+ }
- if (found) {
- if (found->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
- num_found == 1)
- {
- menu_frame_select(frame, found, TRUE);
- usleep(50000); /* highlight the item for a short bit so the
- user can see what happened */
- menu_entry_frame_execute(found, state);
- } else {
- menu_frame_select(frame, found, TRUE);
- if (num_found == 1)
- menu_frame_select_next(frame->child);
- }
+ /* next with wraparound */
+ it = g_list_next(it);
+ if (it == NULL) it = frame->entries;
+ } while (it != start);
- ret = TRUE;
+ if (found) {
+ if (found->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
+ num_found == 1)
+ {
+ menu_frame_select(frame, found, TRUE);
+ usleep(50000); /* highlight the item for a short bit so
+ the user can see what happened */
+ menu_entry_frame_execute(found, state);
+ } else {
+ menu_frame_select(frame, found, TRUE);
+ if (num_found == 1)
+ menu_frame_select_next(frame->child);
+ }
+
+ ret = TRUE;
+ }
}
}
}
if (interactive) {
if (ft != focus_cycle_target) { /* prevents flicker */
focus_cycle_target = ft;
+ focus_cycle_type = OB_CYCLE_NORMAL;
focus_cycle_draw_indicator(showbar ? ft : NULL);
}
- if (dialog)
- /* same arguments as focus_target_valid */
- focus_cycle_popup_show(ft,
- focus_cycle_iconic_windows,
- focus_cycle_all_desktops,
- focus_cycle_dock_windows,
- focus_cycle_desktop_windows);
+ /* same arguments as focus_target_valid */
+ focus_cycle_popup_show(ft,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows,
+ mode);
return focus_cycle_target;
} else if (ft != focus_cycle_target) {
focus_cycle_target = ft;
return ret;
}
- return focus_valid_target(client, TRUE,
+
+ gboolean focus_cycle_valid(struct _ObClient *client)
+ {
++ return focus_valid_target(client, screen_desktop, TRUE,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows,
+ FALSE);
+ }
RrAppearanceFree(popup.a_bg);
}
- static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
- gboolean iconic_windows, gboolean all_desktops,
- gboolean dock_windows, gboolean desktop_windows)
+ static void popup_target_free(ObFocusCyclePopupTarget *t)
+ {
+ RrImageUnref(t->icon);
+ g_free(t->text);
- XDestroyWindow(ob_display, t->win);
++ XDestroyWindow(obt_display, t->iconwin);
++ XDestroyWindow(obt_display, t->textwin);
+ g_free(t);
+ }
+
+ static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
+ gboolean refresh_targets)
{
gint maxwidth, n;
GList *it;
for (it = g_list_last(focus_order); it; it = g_list_previous(it)) {
ObClient *ft = it->data;
- if (focus_valid_target(ft, screen_desktop, TRUE,
- iconic_windows,
- all_desktops,
- dock_windows,
- desktop_windows,
- FALSE))
- {
- gchar *text = popup_get_name(ft);
+ if (focus_cycle_valid(ft)) {
+ GList *rit;
- /* measure */
- p->a_text->texture[0].data.text.string = text;
- maxwidth = MAX(maxwidth, RrMinWidth(p->a_text));
+ /* reuse the target if possible during refresh */
+ for (rit = rtlast; rit; rit = g_list_previous(rit)) {
+ ObFocusCyclePopupTarget *t = rit->data;
+ if (t->client == ft) {
+ if (rit == rtlast)
+ rtlast = g_list_previous(rit);
+ rtargets = g_list_remove_link(rtargets, rit);
- if (!create_targets) {
- g_free(text);
- } else {
- ObFocusCyclePopupTarget *t = g_new(ObFocusCyclePopupTarget, 1);
+ p->targets = g_list_concat(rit, p->targets);
+ ++n;
+
+ if (rit != rtlast)
+ change = TRUE; /* order changed */
+ break;
+ }
+ }
+
+ if (!rit) {
+ gchar *text = popup_get_name(ft);
+
+ /* measure */
+ p->a_text->texture[0].data.text.string = text;
+ maxwidth = MAX(maxwidth, RrMinWidth(p->a_text));
- t->client = ft;
- t->text = text;
- t->icon = client_icon(t->client);
- RrImageRef(t->icon); /* own the icon so it won't go away */
- t->iconwin = create_window(p->bg, 0, 0, NULL);
- t->textwin = create_window(p->bg, 0, 0, NULL);
- if (!create_targets)
++ if (!create_targets) {
+ g_free(text);
- else {
++ } else {
+ ObFocusCyclePopupTarget *t =
+ g_new(ObFocusCyclePopupTarget, 1);
+
+ t->client = ft;
+ t->text = text;
+ t->icon = client_icon(t->client);
+ RrImageRef(t->icon); /* own the icon so it won't go away */
- t->win = create_window(p->bg, 0, 0, NULL);
-
- XMapWindow(ob_display, t->win);
++ t->iconwin = create_window(p->bg, 0, 0, NULL);
++ t->textwin = create_window(p->bg, 0, 0, NULL);
- p->targets = g_list_prepend(p->targets, t);
- ++n;
+ p->targets = g_list_prepend(p->targets, t);
+ ++n;
+
+ change = TRUE; /* added a window */
+ }
}
}
}
+ if (rtargets) {
+ change = TRUE; /* removed a window */
+
+ while (rtargets) {
+ popup_target_free(rtargets->data);
+ rtargets = g_list_delete_link(rtargets, rtargets);
+ }
+ }
+
p->n_targets = n;
-- p->maxtextw = maxwidth;
++ if (refresh_targets)
++ /* don't shrink when refreshing */
++ p->maxtextw = MAX(p->maxtextw, maxwidth);
++ else
++ p->maxtextw = maxwidth;
+
+ return change;
+ }
+
+ static void popup_cleanup(void)
+ {
+ while(popup.targets) {
+ popup_target_free(popup.targets->data);
+ popup.targets = g_list_delete_link(popup.targets, popup.targets);
+ }
+ popup.n_targets = 0;
+ popup.last_target = NULL;
}
static gchar *popup_get_name(ObClient *c)
{
g_assert(c != NULL);
+ if (mode == OB_FOCUS_CYCLE_POPUP_MODE_NONE) {
+ focus_cycle_popup_hide();
+ return;
+ }
+
/* do this stuff only when the dialog is first showing */
- if (!popup.mapped)
+ if (!popup.mapped) {
- popup_setup(&popup, TRUE, iconic_windows, all_desktops,
- dock_windows, desktop_windows);
+ popup_setup(&popup, TRUE, FALSE);
+ /* this is fixed once the dialog is shown */
+ popup.mode = mode;
+ }
g_assert(popup.targets != NULL);
popup_render(&popup, c);
popup.mapped = FALSE;
- while(popup.targets) {
- ObFocusCyclePopupTarget *t = popup.targets->data;
-
- RrImageUnref(t->icon);
- g_free(t->text);
- XDestroyWindow(obt_display, t->iconwin);
- XDestroyWindow(obt_display, t->textwin);
- g_free(t);
-
- popup.targets = g_list_delete_link(popup.targets, popup.targets);
- }
- popup.n_targets = 0;
- popup.last_target = NULL;
+ popup_cleanup();
-
- g_free(popup.hilite_rgba);
- popup.hilite_rgba = NULL;
}
void focus_cycle_popup_single_show(struct _ObClient *c,
}
return FALSE;
}
- XFlush(ob_display);
+
+ static ObClient* popup_revert(ObClient *target)
+ {
+ GList *it, *itt;
+
+ for (it = popup.targets; it; it = g_list_next(it)) {
+ ObFocusCyclePopupTarget *t = it->data;
+ if (t->client == target) {
+ /* move to a previous window if possible */
+ for (itt = it->prev; itt; itt = g_list_previous(itt)) {
+ ObFocusCyclePopupTarget *t2 = itt->data;
+ if (focus_cycle_valid(t2->client))
+ return t2->client;
+ }
+
+ /* otherwise move to a following window if possible */
+ for (itt = it->next; itt; itt = g_list_next(itt)) {
+ ObFocusCyclePopupTarget *t2 = itt->data;
+ if (focus_cycle_valid(t2->client))
+ return t2->client;
+ }
+
+ /* otherwise, we can't go anywhere there is nowhere valid to go */
+ return NULL;
+ }
+ }
+ return NULL;
+ }
+
+ ObClient* focus_cycle_popup_refresh(ObClient *target,
+ gboolean redraw)
+ {
+ if (!popup.mapped) return NULL;
+
+ if (!focus_cycle_valid(target))
+ target = popup_revert(target);
+
+ redraw = popup_setup(&popup, TRUE, TRUE) && redraw;
+
+ if (!target && popup.targets)
+ target = ((ObFocusCyclePopupTarget*)popup.targets->data)->client;
+
+ if (target && redraw) {
+ popup.mapped = FALSE;
+ popup_render(&popup, target);
++ XFlush(obt_display);
+ popup.mapped = TRUE;
+ }
+
+ return target;
+ }
gboolean all_desktops,
gboolean dock_windows,
gboolean desktop_windows);
-void focus_cycle_popup_single_hide();
+void focus_cycle_popup_single_hide(void);
- /*! Returns TRUE if the popup is showing the client, otherwise FALSE. */
- gboolean focus_cycle_popup_is_showing(struct _ObClient *client);
+ gboolean focus_cycle_popup_is_showing(struct _ObClient *c);
+
+ /*! Redraws the focus cycle popup, and returns the current target. If
+ the target given to the function is no longer valid, this will return
+ a different target that is valid, and which should be considered the
+ current focus cycling target. */
+ struct _ObClient *focus_cycle_popup_refresh(struct _ObClient *target,
+ gboolean redraw);
#endif
do {
ObPrompt *xmlprompt = NULL;
- modkeys_startup(reconfigure);
+ if (reconfigure) obt_keyboard_reload();
/* get the keycodes for keys we use */
- keys[OB_KEY_RETURN] = modkeys_sym_to_code(XK_Return);
- keys[OB_KEY_ESCAPE] = modkeys_sym_to_code(XK_Escape);
- keys[OB_KEY_LEFT] = modkeys_sym_to_code(XK_Left);
- keys[OB_KEY_RIGHT] = modkeys_sym_to_code(XK_Right);
- keys[OB_KEY_UP] = modkeys_sym_to_code(XK_Up);
- keys[OB_KEY_DOWN] = modkeys_sym_to_code(XK_Down);
- keys[OB_KEY_TAB] = modkeys_sym_to_code(XK_Tab);
- keys[OB_KEY_SPACE] = modkeys_sym_to_code(XK_space);
- keys[OB_KEY_HOME] = modkeys_sym_to_code(XK_Home);
- keys[OB_KEY_END] = modkeys_sym_to_code(XK_End);
+ keys[OB_KEY_RETURN] = obt_keyboard_keysym_to_keycode(XK_Return);
+ keys[OB_KEY_ESCAPE] = obt_keyboard_keysym_to_keycode(XK_Escape);
+ keys[OB_KEY_LEFT] = obt_keyboard_keysym_to_keycode(XK_Left);
+ keys[OB_KEY_RIGHT] = obt_keyboard_keysym_to_keycode(XK_Right);
+ keys[OB_KEY_UP] = obt_keyboard_keysym_to_keycode(XK_Up);
+ keys[OB_KEY_DOWN] = obt_keyboard_keysym_to_keycode(XK_Down);
+ keys[OB_KEY_TAB] = obt_keyboard_keysym_to_keycode(XK_Tab);
+ keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space);
++ keys[OB_KEY_HOME] = obt_keyboard_keysym_to_keycode(XK_Home);
++ keys[OB_KEY_END] = obt_keyboard_keysym_to_keycode(XK_End);
{
- ObParseInst *i;
- xmlDocPtr doc;
- xmlNodePtr node;
+ ObtXmlInst *i;
/* startup the parsing so everything can register sections
of the rc */
g_free(keys[OB_KEY_DOWN]);
g_free(keys[OB_KEY_TAB]);
g_free(keys[OB_KEY_SPACE]);
-
- modkeys_shutdown(reconfigure);
+ g_free(keys[OB_KEY_HOME]);
+ g_free(keys[OB_KEY_END]);
} while (reconfigure);
}
#include "focus.h"
#include "focus_cycle.h"
#include "popup.h"
-#include "extensions.h"
-#include "render/render.h"
++#include "version.h"
+#include "obrender/render.h"
#include "gettext.h"
+#include "obt/display.h"
+#include "obt/prop.h"
+#include "obt/mainloop.h"
#include <X11/Xlib.h>
#ifdef HAVE_UNISTD_H
/* set the _NET_SUPPORTED_ATOMS hint */
- /* 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;
+ /* this is all the atoms after NET_SUPPORTED in the ObtPropAtoms enum */
+ num_support = OBT_PROP_NUM_ATOMS - OBT_PROP_NET_SUPPORTED - 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;
- supported[i++] = prop_atoms.net_desktop_geometry;
- supported[i++] = prop_atoms.net_desktop_viewport;
- supported[i++] = prop_atoms.net_active_window;
- supported[i++] = prop_atoms.net_workarea;
- supported[i++] = prop_atoms.net_client_list;
- supported[i++] = prop_atoms.net_client_list_stacking;
- supported[i++] = prop_atoms.net_desktop_names;
- supported[i++] = prop_atoms.net_close_window;
- supported[i++] = prop_atoms.net_desktop_layout;
- supported[i++] = prop_atoms.net_showing_desktop;
- supported[i++] = prop_atoms.net_wm_name;
- supported[i++] = prop_atoms.net_wm_visible_name;
- supported[i++] = prop_atoms.net_wm_icon_name;
- 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;
- supported[i++] = prop_atoms.net_wm_window_type_toolbar;
- supported[i++] = prop_atoms.net_wm_window_type_menu;
- supported[i++] = prop_atoms.net_wm_window_type_utility;
- supported[i++] = prop_atoms.net_wm_window_type_splash;
- supported[i++] = prop_atoms.net_wm_window_type_dialog;
- supported[i++] = prop_atoms.net_wm_window_type_normal;
- supported[i++] = prop_atoms.net_wm_allowed_actions;
- supported[i++] = prop_atoms.net_wm_action_move;
- supported[i++] = prop_atoms.net_wm_action_resize;
- supported[i++] = prop_atoms.net_wm_action_minimize;
- supported[i++] = prop_atoms.net_wm_action_shade;
- supported[i++] = prop_atoms.net_wm_action_maximize_horz;
- supported[i++] = prop_atoms.net_wm_action_maximize_vert;
- supported[i++] = prop_atoms.net_wm_action_fullscreen;
- supported[i++] = prop_atoms.net_wm_action_change_desktop;
- supported[i++] = prop_atoms.net_wm_action_close;
- supported[i++] = prop_atoms.net_wm_action_above;
- supported[i++] = prop_atoms.net_wm_action_below;
- supported[i++] = prop_atoms.net_wm_state;
- supported[i++] = prop_atoms.net_wm_state_modal;
- supported[i++] = prop_atoms.net_wm_state_maximized_vert;
- supported[i++] = prop_atoms.net_wm_state_maximized_horz;
- supported[i++] = prop_atoms.net_wm_state_shaded;
- supported[i++] = prop_atoms.net_wm_state_skip_taskbar;
- supported[i++] = prop_atoms.net_wm_state_skip_pager;
- supported[i++] = prop_atoms.net_wm_state_hidden;
- supported[i++] = prop_atoms.net_wm_state_fullscreen;
- supported[i++] = prop_atoms.net_wm_state_above;
- supported[i++] = prop_atoms.net_wm_state_below;
- supported[i++] = prop_atoms.net_wm_state_demands_attention;
- supported[i++] = prop_atoms.net_moveresize_window;
- supported[i++] = prop_atoms.net_wm_moveresize;
- supported[i++] = prop_atoms.net_wm_user_time;
+ supported[i++] = OBT_PROP_ATOM(NET_SUPPORTING_WM_CHECK);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_FULL_PLACEMENT);
+ supported[i++] = OBT_PROP_ATOM(NET_CURRENT_DESKTOP);
+ supported[i++] = OBT_PROP_ATOM(NET_NUMBER_OF_DESKTOPS);
+ supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_GEOMETRY);
+ supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_VIEWPORT);
+ supported[i++] = OBT_PROP_ATOM(NET_ACTIVE_WINDOW);
+ supported[i++] = OBT_PROP_ATOM(NET_WORKAREA);
+ supported[i++] = OBT_PROP_ATOM(NET_CLIENT_LIST);
+ supported[i++] = OBT_PROP_ATOM(NET_CLIENT_LIST_STACKING);
+ supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_NAMES);
+ supported[i++] = OBT_PROP_ATOM(NET_CLOSE_WINDOW);
+ supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_LAYOUT);
+ supported[i++] = OBT_PROP_ATOM(NET_SHOWING_DESKTOP);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_NAME);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_VISIBLE_NAME);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ICON_NAME);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_VISIBLE_ICON_NAME);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_DESKTOP);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STRUT);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STRUT_PARTIAL);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ICON);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ICON_GEOMETRY);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DESKTOP);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_TOOLBAR);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_MENU);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_UTILITY);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_SPLASH);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DIALOG);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_NORMAL);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ALLOWED_ACTIONS);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MOVE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_RESIZE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MINIMIZE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_SHADE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_HORZ);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_VERT);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_FULLSCREEN);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_CHANGE_DESKTOP);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_CLOSE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_ABOVE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_BELOW);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MODAL);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SHADED);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_HIDDEN);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_ABOVE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_BELOW);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION);
+ supported[i++] = OBT_PROP_ATOM(NET_MOVERESIZE_WINDOW);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_MOVERESIZE);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_USER_TIME);
/*
- supported[i++] = prop_atoms.net_wm_user_time_window;
+ supported[i++] = OBT_PROP_ATOM(NET_WM_USER_TIME_WINDOW);
*/
- supported[i++] = prop_atoms.net_frame_extents;
- supported[i++] = prop_atoms.net_request_frame_extents;
- supported[i++] = prop_atoms.net_restack_window;
- supported[i++] = prop_atoms.net_startup_id;
+ supported[i++] = OBT_PROP_ATOM(NET_FRAME_EXTENTS);
+ supported[i++] = OBT_PROP_ATOM(NET_REQUEST_FRAME_EXTENTS);
+ supported[i++] = OBT_PROP_ATOM(NET_RESTACK_WINDOW);
+ supported[i++] = OBT_PROP_ATOM(NET_STARTUP_ID);
#ifdef SYNC
- supported[i++] = prop_atoms.net_wm_sync_request;
- supported[i++] = prop_atoms.net_wm_sync_request_counter;
+ supported[i++] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST_COUNTER);
#endif
- supported[i++] = prop_atoms.net_wm_pid;
- supported[i++] = prop_atoms.net_wm_ping;
-
- 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.ob_wm_action_undecorate;
- supported[i++] = prop_atoms.ob_wm_state_undecorated;
- supported[i++] = prop_atoms.openbox_pid;
- supported[i++] = prop_atoms.ob_theme;
- supported[i++] = prop_atoms.ob_config_file;
- supported[i++] = prop_atoms.ob_control;
- supported[i++] = prop_atoms.ob_version;
- supported[i++] = prop_atoms.ob_app_role;
- supported[i++] = prop_atoms.ob_app_name;
- supported[i++] = prop_atoms.ob_app_class;
- supported[i++] = prop_atoms.ob_app_type;
+ supported[i++] = OBT_PROP_ATOM(NET_WM_PID);
+ supported[i++] = OBT_PROP_ATOM(NET_WM_PING);
+
+ supported[i++] = OBT_PROP_ATOM(KDE_WM_CHANGE_STATE);
+ supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_FRAME_STRUT);
+ supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
+
+ supported[i++] = OBT_PROP_ATOM(OB_WM_ACTION_UNDECORATE);
+ supported[i++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
+ supported[i++] = OBT_PROP_ATOM(OPENBOX_PID);
+ supported[i++] = OBT_PROP_ATOM(OB_THEME);
+ supported[i++] = OBT_PROP_ATOM(OB_CONFIG_FILE);
+ supported[i++] = OBT_PROP_ATOM(OB_CONTROL);
- supported[i++] = OBT_PROP_ATOM(OB_ROLE);
- supported[i++] = OBT_PROP_ATOM(OB_NAME);
- supported[i++] = OBT_PROP_ATOM(OB_CLASS);
++ supported[i++] = OBT_PROP_ATOM(OB_VERSION);
++ supported[i++] = OBT_PROP_ATOM(OB_APP_ROLE);
++ supported[i++] = OBT_PROP_ATOM(OB_APP_NAME);
++ supported[i++] = OBT_PROP_ATOM(OB_APP_CLASS);
++ supported[i++] = OBT_PROP_ATOM(OB_APP_TYPE);
g_assert(i == num_support);
- PROP_SETA32(RootWindow(ob_display, ob_screen),
- net_supported, atom, supported, num_support);
+ OBT_PROP_SETA32(obt_root(ob_screen),
+ NET_SUPPORTED, ATOM, supported, num_support);
g_free(supported);
- PROP_SETS(RootWindow(ob_display, ob_screen), ob_version,
- OB_VERSION);
++ OBT_PROP_SETS(RootWindow(obt_display, ob_screen), OB_VERSION, utf8,
++ OPENBOX_VERSION);
+
screen_tell_ksplash();
return TRUE;
--- /dev/null
-#define OB_MAJOR_VERSION @OB_MAJOR_VERSION@
-#define OB_MINOR_VERSION @OB_MINOR_VERSION@
-#define OB_MICRO_VERSION @OB_MICRO_VERSION@
-#define OB_VERSION "@OB_VERSION@"
-
-#define OB_CHECK_VERSION(major,minor,micro) \
- (OB_MAJOR_VERSION > (major) || \
- (OB_MAJOR_VERSION == (major) && OB_MINOR_VERSION > (minor)) || \
- (OB_MAJOR_VERSION == (major) && OB_MINOR_VERSION == (minor) && \
- OB_MICRO_VERSION >= (micro)))
+ #ifndef ob__version_h
+ #define ob__version_h
+
++#define OPENBOX_VERSION "@OPENBOX_VERSION@"
+
+ #endif