Backport fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/stable@26776 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2008-07-12 23:47:41 +00:00
parent 3f86969b58
commit f282721c53
9 changed files with 148 additions and 27 deletions

View file

@ -1,3 +1,39 @@
2008-07-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/xlib/GSXftFontInfo.m (-setupAttributes:),
* Source/xlib/XGFontSetFontInfo.m (-setupAttributes:),
* Source/xlib/XGFont.m (-setupAttributes:),
* Source/art/ftfont.m (-setupAttributes:),
* Source/art/ftfont-old.m (-setupAttributes): Correct the sign of
the descender in the bounding box.
2008-07-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/xlib/GSXftFontInfo.m (-setupAttributes:),
* Source/xlib/XGFontSetFontInfo.m (-setupAttributes:),
* Source/xlib/XGFont.m (-setupAttributes:): Correct the setting of
fontBBox, used for boundingRectForFont.
2008-07-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (-setinputstate:): Disable new code,
as it does not work on KDE 4.
2008-07-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (-setinputfocus:): For EWMH window
managers set the user time before requesting focus.
* Source/x11/XGServerWindow.m (-setinputstate:): For EWMH window
managers set active window status.
Based on patch by Hubert Chathi <hubert@uhoreg.ca>.
2008-06-26 Fred Kiefer <FredKiefer@gmx.de>
* Source/cairo/CairoGState.m (-copyWithZone:): Use a runtime
version check and adjust from > to >= 1.6.0.
* Source/cairo/CairoFontInfo.m (-setupAttributes): Slightly better
error checks.
2008-06-14 Adam Fedor <fedor@gnu.org>
* Version 0.14.0

View file

@ -246,7 +246,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
xHeight = ascender * 0.5; /* TODO */
maximumAdvancement = NSMakeSize((size->metrics.max_advance / 64.0), ascender + descender);
fontBBox = NSMakeRect(0, descender, maximumAdvancement.width, ascender + descender);
fontBBox = NSMakeRect(0, -descender, maximumAdvancement.width, ascender + descender);
descender = -descender;
/* printf("(%@) h=%g a=%g d=%g max=(%g %g) (%g %g)+(%g %g)\n",name,

View file

@ -262,7 +262,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
maximumAdvancement = NSMakeSize((ft_size->metrics.max_advance / 64.0), 0.0);
fontBBox
= NSMakeRect(0, descender, maximumAdvancement.width, ascender + descender);
= NSMakeRect(0, -descender, maximumAdvancement.width, ascender + descender);
descender = -descender;
/* printf("(%@) h=%g a=%g d=%g max=(%g %g) (%g %g)+(%g %g)\n",name,

View file

@ -93,25 +93,36 @@
*/
cairo_matrix_init(&font_matrix, matrix[0], matrix[1], matrix[2],
matrix[3], matrix[4], matrix[5]);
//cairo_matrix_scale(&font_matrix, 0.9, 0.9);
cairo_matrix_init_identity(&ctm);
// FIXME: Should get default font options from somewhere
options = cairo_font_options_create();
face = [_faceInfo fontFace];
if (!face)
{
return NO;
}
_scaled = cairo_scaled_font_create(face, &font_matrix, &ctm, options);
cairo_font_options_destroy(options);
if (!_scaled)
// Get default font options
options = cairo_font_options_create();
if (cairo_font_options_status(options) != CAIRO_STATUS_SUCCESS)
{
return NO;
}
_scaled = cairo_scaled_font_create(face, &font_matrix, &ctm, options);
cairo_font_options_destroy(options);
if (cairo_scaled_font_status(_scaled) != CAIRO_STATUS_SUCCESS)
{
return NO;
}
cairo_scaled_font_extents(_scaled, &font_extents);
if (cairo_scaled_font_status(_scaled) != CAIRO_STATUS_SUCCESS)
{
return NO;
}
ascender = font_extents.ascent;
// The FreeType documentation claims this value is already negative, but it isn't.
descender = -font_extents.descent;
xHeight = ascender * 0.6;
lineHeight = font_extents.height;
@ -119,6 +130,16 @@
font_extents.max_y_advance);
fontBBox = NSMakeRect(0, descender,
maximumAdvancement.width, ascender - descender);
/*
NSLog(@"Font matrix (%g, %g, %g, %g, %g, %g) type %d",
matrix[0], matrix[1], matrix[2],
matrix[3], matrix[4], matrix[5], cairo_scaled_font_get_type(_scaled));
NSLog(@"(%@) h=%g a=%g d=%g max=(%g %g) (%g %g)+(%g %g)\n", fontName,
xHeight, ascender, descender,
maximumAdvancement.width, maximumAdvancement.height,
fontBBox.origin.x, fontBBox.origin.y,
fontBBox.size.width, fontBBox.size.height);
*/
return YES;
}

View file

@ -205,22 +205,34 @@ static float floatToUserSpace(NSAffineTransform *ctm, float f)
{
int i;
if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 6, 0))
{
for (i = 0; i < clip_rects->num_rectangles; i++)
{
cairo_rectangle_t rect = clip_rects->rectangles[i];
cairo_rectangle(copy->_ct, rect.x, rect.y,
rect.width, rect.height);
cairo_clip(copy->_ct);
}
}
else
{
for (i = 0; i < clip_rects->num_rectangles; i++)
{
cairo_rectangle_t rect = clip_rects->rectangles[i];
NSSize size = [_surface size];
cairo_rectangle(copy->_ct, rect.x,
#if CAIRO_VERSION > CAIRO_VERSION_ENCODE(1, 6, 0)
rect.y,
#else
// This strange computation is due to the device offset.
/* This strange computation is due
to the device offset missing for
clip rects in cairo < 1.6.0. */
rect.y + 2*(offset.y - size.height),
#endif
rect.width, rect.height);
cairo_clip(copy->_ct);
}
}
}
cairo_rectangle_list_destroy(clip_rects);
#endif
}

View file

@ -1556,6 +1556,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
pid_atom, XA_CARDINAL,
32, PropModeReplace,
(unsigned char*)&pid, 1);
// FIXME: Need to set WM_CLIENT_MACHINE as well.
}
/* We need to determine the offsets between the actual decorated window
@ -2001,12 +2002,15 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
window->numProtocols = 0;
window->protocols[window->numProtocols++] = generic.take_focus_atom;
window->protocols[window->numProtocols++] = generic.delete_win_atom;
// Add ping protocol for EWMH
if ((generic.wm & XGWM_EWMH) != 0)
{
window->protocols[window->numProtocols++] = generic.net_wm_ping_atom;
}
if ((generic.wm & XGWM_WINDOWMAKER) != 0)
{
window->protocols[window->numProtocols++] = generic.miniaturize_atom;
}
// FIXME Add ping protocol for EWMH
XSetWMProtocols(dpy, window->ident, window->protocols, window->numProtocols);
window->exposedRects = [NSMutableArray new];
@ -3612,6 +3616,21 @@ static BOOL didCreatePixmaps;
return;
}
if ((generic.wm & XGWM_EWMH) != 0)
{
static Atom user_time_atom = None;
Time last = [self lastTime];
if (user_time_atom == None)
{
user_time_atom = XInternAtom(dpy, "_NET_WM_USER_TIME", False);
}
NSDebugLLog(@"Focus", @"Setting user time for %d to %ul", window->ident, last);
XChangeProperty(dpy, window->ident, user_time_atom, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&last, 1);
}
NSDebugLLog(@"Focus", @"Setting focus to %d", window->number);
generic.desiredFocusWindow = win;
generic.focusRequestNumber = XNextRequest(dpy);
@ -3646,6 +3665,39 @@ static BOOL didCreatePixmaps;
data2: 0
data3: 0];
}
#if 0
else if ((generic.wm & XGWM_EWMH) != 0)
{
if ((st == GSTitleBarKey) || (st == GSTitleBarMain))
{
static Atom active_window_atom = None;
gswindow_device_t *window = WINDOW_WITH_TAG(win);
if (win == 0 || window == 0)
{
return;
}
if (active_window_atom == None)
{
active_window_atom = XInternAtom(window->display,
"_NET_ACTIVE_WINDOW", False);
}
/*
* Work around "focus stealing prevention" by first asking for focus
* before we try to take it.
*/
[self _sendRoot: window->root
type: active_window_atom
window: window->ident
data0: 1
data1: [self lastTime]
data2: 0
data3: 0];
}
}
#endif
}
/** Sets the transparancy value for the whole window */

View file

@ -940,7 +940,7 @@ static FT_Outline_Funcs bezierpath_funcs = {
xHeight = capHeight*0.6; //Errr... TODO
fontBBox = NSMakeRect(
(float)(0),
(float)(0 - font_info->ascent),
(float)(-font_info->descent),
(float)(font_info->max_advance_width),
(float)(font_info->ascent + font_info->descent));
maximumAdvancement = NSMakeSize(font_info->max_advance_width, 0.0);

View file

@ -304,8 +304,8 @@ static BOOL XGInitAtoms(Display *dpy)
ascender = font_info->ascent;
descender = -(font_info->descent);
fontBBox = NSMakeRect(
(float)(0 + font_info->min_bounds.lbearing),
(float)(0 - font_info->max_bounds.ascent),
(float)(font_info->min_bounds.lbearing),
(float)(-font_info->max_bounds.descent),
(float)(font_info->max_bounds.rbearing - font_info->min_bounds.lbearing),
(float)(font_info->max_bounds.ascent + font_info->max_bounds.descent));
maximumAdvancement = NSMakeSize(font_info->max_bounds.width, 0.0);

View file

@ -132,7 +132,7 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set,
mostCompatibleStringEncoding = NSASCIIStringEncoding;
fontBBox =
NSMakeRect(base->min_bounds.lbearing,
-base->max_bounds.ascent,
-base->max_bounds.descent,
base->max_bounds.rbearing - base->max_bounds.lbearing,
base->max_bounds.ascent + base->max_bounds.descent);
isFixedPitch = XGFontIsFixedPitch(dpy, base);