summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-04-20 02:10:02 +0000
committersabetts <sabetts>2006-04-20 02:10:02 +0000
commitb7bb91712d275065bb4b2440fd0867d9299da94c (patch)
tree20fffc9fd31e077b23a44fedd3480c70c84b332a /src/manage.c
parent91a86a505d76d9a4a0b89ddaaefa631a660c4835 (diff)
downloadratpoison-b7bb91712d275065bb4b2440fd0867d9299da94c.zip
* src/split.c (show_frame_message): use XmbDrawString and XmbTextEscapement
* src/screen.c (init_screen): don't include the font in the gc * src/ratpoison.h: include Xlocale.h * src/manage.c (get_wmname): support i18n characters * src/main.c (init_defaults): call load_query_font_set and set_extents_of_fontset (main): call setlocale (clean_up): call XFreeFontSet (set_extents_of_fontset): new function (load_query_font_set): likewise * src/input.c (update_input_window): use XmbTextEscapement and XmbDrawString * src/globals.h (FONT_HEIGHT): use rp_font_ascent and rp_font_descent (MAX_FONT_WIDTH): use rp_font_width new globals rp_font_ascent, rp_font_descent, rp_font_width * src/globals.c: new globals rp_font_ascent, rp_font_descent, rp_font_width * src/data.h (struct rp_defaults): font is a XFontSet * src/bar.c (max_line_length): call XmbTextEscapement (draw_string): call XmbDrawString (get_mark_box): call XmbTextEscapement * src/actions.c (read_frame): call XmbTextEscapement (cmd_license): likewise (read_frame): call XmbDrawString (cmd_license): likewise (cmd_help): likewise (update_gc): don't include the font (set_font): call load_query_font_set
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/manage.c b/src/manage.c
index dd5eae9..d757cb4 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -198,33 +198,29 @@ update_normal_hints (rp_window *win)
static char *
get_wmname (Window w)
{
- Atom actual_type;
- int actual_format;
- int status;
- unsigned long n;
- unsigned long bytes_after;
unsigned char *name = NULL;
char *ret;
-
- status = XGetWindowProperty (dpy, w, wm_name, 0L, 100L, False,
- XA_STRING, &actual_type, &actual_format,
- &n, &bytes_after, &name);
-
- PRINT_DEBUG (("XGetWindowProperty: %d %ld %d %ld %ld '%s'\n", status, actual_type,
- actual_format, n, bytes_after, name));
-
- if (status != Success || name == NULL)
- {
- PRINT_DEBUG (("I can't get the WMName.\n"));
- return NULL;
- }
-
- if (n == 0)
- {
- PRINT_DEBUG (("I can't get the WMName.\n"));
- XFree (name);
- return NULL;
- }
+ XTextProperty text_prop;
+ int n;
+ char** cl;
+
+ if (XGetWMName(dpy, w, &text_prop) != 0) {
+ if (text_prop.encoding == XA_STRING) {
+ name = (char *)text_prop.value;
+ } else {
+ XmbTextPropertyToTextList(dpy, &text_prop, &cl, &n);
+ if (cl) {
+ name = strdup(cl[0]);
+ XFreeStringList(cl);
+ } else {
+ PRINT_DEBUG (("I can't get the WMName.\n"));
+ return NULL;
+ }
+ }
+ } else {
+ PRINT_DEBUG (("I can't get the WMName.\n"));
+ return NULL;
+ }
PRINT_DEBUG (("WM_NAME: '%s'\n", name));