summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2005-05-30 20:15:26 +0000
committerRay Strode <halfline@src.gnome.org>2005-05-30 20:15:26 +0000
commit14b8de3727c00ff0b15d361196f13ca55a5446bd (patch)
tree39a9d0a8f1c2bbb881841fd5e028bc1da33ac0bc
parent1799ef6006da3349caa7f13361fe8e896f87b58d (diff)
downloadmetacity-14b8de3727c00ff0b15d361196f13ca55a5446bd.tar.gz
Bug 305564 again.
2005-05-30 Ray Strode <rstrode@redhat.com> Bug 305564 again. When drawing XOR resize popup use "fixed" font instead of -misc-fixed-*-16-* xlfd. Should work on more xservers. Also take steps to fail better if the xserver isn't cooperating. * src/effects.c (draw_xor_rect): if we can't draw font box for whatever reason, at least draw grid frames. * src/screen.c (meta_screen_new): use fixed alias instead of a xfld. Don't pass GCFont to XCreateGC if font couldn't be loaded. Print a warning if font couldn't be loaded.
-rw-r--r--ChangeLog17
-rw-r--r--src/effects.c16
-rw-r--r--src/screen.c22
3 files changed, 43 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index cb67fc8c..790669ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-05-30 Ray Strode <rstrode@redhat.com>
+
+ Bug 305564 again.
+
+ When drawing XOR resize popup use "fixed" font instead of
+ -misc-fixed-*-16-* xlfd. Should work on more xservers.
+
+ Also take steps to fail better if the xserver isn't
+ cooperating.
+
+ * src/effects.c (draw_xor_rect): if we can't draw font box
+ for whatever reason, at least draw grid frames.
+
+ * src/screen.c (meta_screen_new): use fixed alias instead
+ of a xfld. Don't pass GCFont to XCreateGC if font couldn't
+ be loaded. Print a warning if font couldn't be loaded.
+
2005-05-26 Elijah Newren <newren@gmail.com>
* HACKING: Add a clarification that METACITY_VERBOSE needs to be
diff --git a/src/effects.c b/src/effects.c
index 2d1baf4e..17f340b1 100644
--- a/src/effects.c
+++ b/src/effects.c
@@ -472,7 +472,6 @@ draw_xor_rect (MetaScreen *screen,
if ((width >= 0) && (height >= 0))
{
- int box_width, box_height;
XGCValues gc_values = { 0 };
if (XGetGCValues (screen->display->xdisplay,
@@ -485,6 +484,7 @@ draw_xor_rect (MetaScreen *screen,
XFontStruct *font_struct;
int text_width, text_height;
int box_x, box_y;
+ int box_width, box_height;
font_struct = XQueryFont (screen->display->xdisplay,
gc_values.font);
@@ -501,6 +501,7 @@ draw_xor_rect (MetaScreen *screen,
box_width = text_width + 2 * LINE_WIDTH;
box_height = text_height + 2 * LINE_WIDTH;
+
box_x = rect->x + (rect->width - box_width) / 2;
box_y = rect->y + (rect->height - box_height) / 2;
@@ -521,15 +522,14 @@ draw_xor_rect (MetaScreen *screen,
}
g_free (text);
- }
- }
- if ((box_width + LINE_WIDTH) >= (rect->width / 3))
- return;
-
- if ((box_height + LINE_WIDTH) >= (rect->height / 3))
- return;
+ if ((box_width + LINE_WIDTH) >= (rect->width / 3))
+ return;
+ if ((box_height + LINE_WIDTH) >= (rect->height / 3))
+ return;
+ }
+ }
}
/* Two vertical lines at 1/3 and 2/3 */
diff --git a/src/screen.c b/src/screen.c
index 5da71553..75a7bb3c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -546,17 +546,31 @@ meta_screen_new (MetaDisplay *display,
screen->trans_picture = None;
{
+ XFontStruct *font_info;
XGCValues gc_values;
+ gulong value_mask = 0;
gc_values.subwindow_mode = IncludeInferiors;
+ value_mask |= GCSubwindowMode;
gc_values.function = GXinvert;
+ value_mask |= GCFunction;
gc_values.line_width = META_WIREFRAME_XOR_LINE_WIDTH;
- gc_values.font = XLoadFont (screen->display->xdisplay,
- "-misc-fixed-*-*-*-*-16-*-*-*-*-*-*-*");
-
+ value_mask |= GCLineWidth;
+
+ font_info = XLoadQueryFont (screen->display->xdisplay, "fixed");
+
+ if (font_info != NULL)
+ {
+ gc_values.font = font_info->fid;
+ value_mask |= GCFont;
+ XFreeFontInfo (NULL, font_info, 0);
+ }
+ else
+ meta_warning ("xserver doesn't have 'fixed' font.\n");
+
screen->root_xor_gc = XCreateGC (screen->display->xdisplay,
screen->xroot,
- GCSubwindowMode | GCFunction | GCLineWidth | GCFont,
+ value_mask,
&gc_values);
}