diff --git a/ChangeLog b/ChangeLog index cb67fc8c2..790669ec3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-05-30 Ray Strode + + 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 * HACKING: Add a clarification that METACITY_VERBOSE needs to be diff --git a/src/effects.c b/src/effects.c index 2d1baf4ed..17f340b16 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 5da715531..75a7bb3c9 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); }