summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-09-16 14:52:49 -0400
committerDana Jansens <danakj@orodu.net>2011-01-24 14:19:21 -0500
commit5d5714f01e1a7140847f6e7f2922d457f6bbe66a (patch)
tree064f8493aff3db02a7c41f2d29364c7e9b3b66f9 /openbox
parentd3d96b572a9278cf8f3542b56e583b1744b1110f (diff)
Handle STRING and COMPOUND_TEXT type text properties.
STRING should be latin1 text (plus TAB and LF) COMPOUND_TEXT should be encoded in the current locale.
Diffstat (limited to 'openbox')
-rw-r--r--openbox/client.c68
-rw-r--r--openbox/dock.c2
-rw-r--r--openbox/openbox.c7
-rw-r--r--openbox/prompt.c2
-rw-r--r--openbox/screen.c12
5 files changed, 39 insertions, 52 deletions
diff --git a/openbox/client.c b/openbox/client.c
index e666d589..012454c7 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -1154,11 +1154,10 @@ static void client_get_all(ObClient *self, gboolean real)
static void client_get_startup_id(ObClient *self)
{
- if (!(OBT_PROP_GETS(self->window, NET_STARTUP_ID, utf8,
- &self->startup_id)))
+ if (!(OBT_PROP_GETS_UTF8(self->window, NET_STARTUP_ID, &self->startup_id)))
if (self->group)
- OBT_PROP_GETS(self->group->leader,
- NET_STARTUP_ID, utf8, &self->startup_id);
+ OBT_PROP_GETS_UTF8(self->group->leader, NET_STARTUP_ID,
+ &self->startup_id);
}
static void client_get_area(ObClient *self)
@@ -1969,15 +1968,14 @@ void client_update_title(ObClient *self)
g_free(self->original_title);
/* try netwm */
- if (!OBT_PROP_GETS(self->window, NET_WM_NAME, utf8, &data)) {
+ if (!OBT_PROP_GETS_UTF8(self->window, NET_WM_NAME, &data)) {
/* try old x stuff */
- if (!(OBT_PROP_GETS(self->window, WM_NAME, locale, &data)
- || OBT_PROP_GETS(self->window, WM_NAME, utf8, &data))) {
+ if (!OBT_PROP_GETS(self->window, WM_NAME, &data)) {
if (self->transient) {
- /*
- GNOME alert windows are not given titles:
- http://developer.gnome.org/projects/gup/hig/draft_hig_new/windows-alert.html
- */
+ /*
+ GNOME alert windows are not given titles:
+ http://developer.gnome.org/projects/gup/hig/draft_hig_new/windows-alert.html
+ */
data = g_strdup("");
} else
data = g_strdup(_("Unnamed Window"));
@@ -2000,7 +1998,7 @@ void client_update_title(ObClient *self)
g_free(data);
}
- OBT_PROP_SETS(self->window, NET_WM_VISIBLE_NAME, utf8, visible);
+ OBT_PROP_SETS(self->window, NET_WM_VISIBLE_NAME, visible);
self->title = visible;
if (self->frame)
@@ -2011,10 +2009,9 @@ void client_update_title(ObClient *self)
g_free(self->icon_title);
/* try netwm */
- if (!OBT_PROP_GETS(self->window, NET_WM_ICON_NAME, utf8, &data))
+ if (!OBT_PROP_GETS_UTF8(self->window, NET_WM_ICON_NAME, &data))
/* try old x stuff */
- if (!(OBT_PROP_GETS(self->window, WM_ICON_NAME, locale, &data) ||
- OBT_PROP_GETS(self->window, WM_ICON_NAME, utf8, &data)))
+ if (!OBT_PROP_GETS(self->window, WM_ICON_NAME, &data))
data = g_strdup(self->title);
if (self->client_machine) {
@@ -2032,7 +2029,7 @@ void client_update_title(ObClient *self)
g_free(data);
}
- OBT_PROP_SETS(self->window, NET_WM_VISIBLE_ICON_NAME, utf8, visible);
+ OBT_PROP_SETS(self->window, NET_WM_VISIBLE_ICON_NAME, visible);
self->icon_title = visible;
}
@@ -2248,19 +2245,14 @@ static void client_get_session_ids(ObClient *self)
leader = None;
/* get the SM_CLIENT_ID */
- got = FALSE;
- if (leader)
- got = OBT_PROP_GETS(leader, SM_CLIENT_ID, locale, &self->sm_client_id);
- if (!got)
- OBT_PROP_GETS(self->window, SM_CLIENT_ID, locale, &self->sm_client_id);
+ if (leader && leader != self->window)
+ OBT_PROP_GETS_XPCS(leader, SM_CLIENT_ID, &self->sm_client_id);
+ else
+ OBT_PROP_GETS_XPCS(self->window, SM_CLIENT_ID, &self->sm_client_id);
/* get the WM_CLASS (name and class). make them "" if they are not
provided */
- got = FALSE;
- if (leader)
- got = OBT_PROP_GETSS(leader, WM_CLASS, locale, &ss);
- if (!got)
- got = OBT_PROP_GETSS(self->window, WM_CLASS, locale, &ss);
+ got = OBT_PROP_GETSS_TYPE(self->window, WM_CLASS, STRING_NO_CC, &ss);
if (got) {
if (ss[0]) {
@@ -2275,11 +2267,7 @@ static void client_get_session_ids(ObClient *self)
if (self->class == NULL) self->class = g_strdup("");
/* get the WM_WINDOW_ROLE. make it "" if it is not provided */
- got = FALSE;
- if (leader)
- got = OBT_PROP_GETS(leader, WM_WINDOW_ROLE, locale, &s);
- if (!got)
- got = OBT_PROP_GETS(self->window, WM_WINDOW_ROLE, locale, &s);
+ got = OBT_PROP_GETS_XPCS(self->window, WM_WINDOW_ROLE, &s);
if (got)
self->role = s;
@@ -2290,9 +2278,9 @@ static void client_get_session_ids(ObClient *self)
got = FALSE;
if (leader)
- got = OBT_PROP_GETSS(leader, WM_COMMAND, locale, &ss);
+ got = OBT_PROP_GETSS(leader, WM_COMMAND, &ss);
if (!got)
- got = OBT_PROP_GETSS(self->window, WM_COMMAND, locale, &ss);
+ got = OBT_PROP_GETSS(self->window, WM_COMMAND, &ss);
if (got) {
/* merge/mash them all together */
@@ -2315,9 +2303,9 @@ static void client_get_session_ids(ObClient *self)
/* get the WM_CLIENT_MACHINE */
got = FALSE;
if (leader)
- got = OBT_PROP_GETS(leader, WM_CLIENT_MACHINE, locale, &s);
+ got = OBT_PROP_GETS(leader, WM_CLIENT_MACHINE, &s);
if (!got)
- got = OBT_PROP_GETS(self->window, WM_CLIENT_MACHINE, locale, &s);
+ got = OBT_PROP_GETS(self->window, WM_CLIENT_MACHINE, &s);
if (got) {
gchar localhost[128];
@@ -2344,10 +2332,10 @@ static void client_save_app_rule_values(ObClient *self)
{
const gchar *type;
- 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);
- OBT_PROP_SETS(self->window, OB_APP_TITLE, utf8, self->original_title);
+ OBT_PROP_SETS(self->window, OB_APP_ROLE, self->role);
+ OBT_PROP_SETS(self->window, OB_APP_NAME, self->name);
+ OBT_PROP_SETS(self->window, OB_APP_CLASS, self->class);
+ OBT_PROP_SETS(self->window, OB_APP_TITLE, self->original_title);
switch (self->type) {
case OB_CLIENT_TYPE_NORMAL:
@@ -2367,7 +2355,7 @@ static void client_save_app_rule_values(ObClient *self)
case OB_CLIENT_TYPE_DOCK:
type = "dock"; break;
}
- OBT_PROP_SETS(self->window, OB_APP_TYPE, utf8, type);
+ OBT_PROP_SETS(self->window, OB_APP_TYPE, type);
}
static void client_change_wm_state(ObClient *self)
diff --git a/openbox/dock.c b/openbox/dock.c
index 06d2280a..00abc530 100644
--- a/openbox/dock.c
+++ b/openbox/dock.c
@@ -145,7 +145,7 @@ void dock_manage(Window icon_win, Window name_win)
app->name_win = name_win;
app->icon_win = icon_win;
- if (OBT_PROP_GETSS(app->name_win, WM_CLASS, locale, &data)) {
+ if (OBT_PROP_GETSS_TYPE(app->name_win, WM_CLASS, STRING_NO_CC, &data)) {
if (data[0]) {
app->name = g_strdup(data[0]);
if (data[1])
diff --git a/openbox/openbox.c b/openbox/openbox.c
index ae0ba8ae..9fd5fe40 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -258,8 +258,7 @@ gint main(gint argc, gchar **argv)
gchar *p = g_filename_to_utf8(config_file, -1,
NULL, NULL, NULL);
if (p)
- OBT_PROP_SETS(obt_root(ob_screen), OB_CONFIG_FILE,
- utf8, p);
+ OBT_PROP_SETS(obt_root(ob_screen), OB_CONFIG_FILE, p);
g_free(p);
}
else
@@ -286,8 +285,8 @@ gint main(gint argc, gchar **argv)
if (ob_rr_theme == NULL)
ob_exit_with_error(_("Unable to load a theme."));
- OBT_PROP_SETS(obt_root(ob_screen),
- OB_THEME, utf8, ob_rr_theme->name);
+ OBT_PROP_SETS(obt_root(ob_screen), OB_THEME,
+ ob_rr_theme->name);
}
if (reconfigure) {
diff --git a/openbox/prompt.c b/openbox/prompt.c
index 77398c5f..08356092 100644
--- a/openbox/prompt.c
+++ b/openbox/prompt.c
@@ -175,7 +175,7 @@ ObPrompt* prompt_new(const gchar *msg, const gchar *title,
/* set the window's title */
if (title)
- OBT_PROP_SETS(self->super.window, NET_WM_NAME, utf8, title);
+ OBT_PROP_SETS(self->super.window, NET_WM_NAME, title);
/* listen for key presses on the window */
self->event_mask = KeyPressMask;
diff --git a/openbox/screen.c b/openbox/screen.c
index 353d2de0..4d73eeac 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -206,7 +206,7 @@ gboolean screen_annex(void)
NET_SUPPORTING_WM_CHECK, WINDOW, screen_support_win);
/* set properties on the supporting window */
- OBT_PROP_SETS(screen_support_win, NET_WM_NAME, utf8, "Openbox");
+ OBT_PROP_SETS(screen_support_win, NET_WM_NAME, "Openbox");
OBT_PROP_SET32(screen_support_win, NET_SUPPORTING_WM_CHECK,
WINDOW, screen_support_win);
@@ -311,7 +311,7 @@ gboolean screen_annex(void)
NET_SUPPORTED, ATOM, supported, num_support);
g_free(supported);
- OBT_PROP_SETS(RootWindow(obt_display, ob_screen), OB_VERSION, utf8,
+ OBT_PROP_SETS(RootWindow(obt_display, ob_screen), OB_VERSION,
OPENBOX_VERSION);
screen_tell_ksplash();
@@ -375,7 +375,7 @@ void screen_startup(gboolean reconfig)
screen_resize();
/* have names already been set for the desktops? */
- if (OBT_PROP_GETSS(obt_root(ob_screen), NET_DESKTOP_NAMES, utf8, &names)) {
+ if (OBT_PROP_GETSS_UTF8(obt_root(ob_screen), NET_DESKTOP_NAMES, &names)) {
g_strfreev(names);
namesexist = TRUE;
}
@@ -397,7 +397,7 @@ void screen_startup(gboolean reconfig)
/* set the root window property */
OBT_PROP_SETSS(obt_root(ob_screen),
- NET_DESKTOP_NAMES, utf8, (const gchar*const*)names);
+ NET_DESKTOP_NAMES, (const gchar*const*)names);
g_strfreev(names);
}
@@ -1182,7 +1182,7 @@ void screen_update_desktop_names(void)
screen_desktop_names = NULL;
if (OBT_PROP_GETSS(obt_root(ob_screen),
- NET_DESKTOP_NAMES, utf8, &screen_desktop_names))
+ NET_DESKTOP_NAMES, &screen_desktop_names))
for (i = 0; screen_desktop_names[i] && i < screen_num_desktops; ++i);
else
i = 0;
@@ -1209,7 +1209,7 @@ void screen_update_desktop_names(void)
/* if we changed any names, then set the root property so we can
all agree on the names */
OBT_PROP_SETSS(obt_root(ob_screen), NET_DESKTOP_NAMES,
- utf8, (const gchar*const*)screen_desktop_names);
+ (const gchar*const*)screen_desktop_names);
}
/* resize the pager for these names */