mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
Window frame/coordinate handling cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c15fdb8e9c
commit
eedc280b9d
13 changed files with 148 additions and 94 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2006-09-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/art/ARTContext.m:
|
||||
* Source/art/path.m:
|
||||
* Source/art/composite.m:
|
||||
* Source/art/shfill.m:
|
||||
* Source/art/image.m:
|
||||
* Source/xlib/XGGState.m:
|
||||
* Source/x11/XGServerWindow.m:
|
||||
* Source/x11/XGServerEvent.m:
|
||||
Get backend to generate NSEvent objects with event location given in
|
||||
OpernStep coordinates.
|
||||
Update art backend to try to honor the x and y window offsets
|
||||
provided in the graphics state.
|
||||
|
||||
2006-09-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/x11/XGServerWindow.m: ([_XFrameToOSFrame:for:]) fix transform
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _GSGState_h_INCLUDE
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _XGGState_h_INCLUDE
|
||||
|
|
|
@ -196,8 +196,8 @@ very expensive
|
|||
|
||||
numarray[0] = ax; numarray[1] = ay;
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -229,8 +229,8 @@ very expensive
|
|||
numarray[0] = ax; numarray[1] = ay;
|
||||
numarray[2] = cx; numarray[3] = cy;
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -270,8 +270,8 @@ very expensive
|
|||
if ([path isEmpty]) return;
|
||||
p = [path currentPoint];
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -300,8 +300,8 @@ very expensive
|
|||
|
||||
numarray[0] = cx; numarray[1] = cy;
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -327,8 +327,8 @@ very expensive
|
|||
if ([path isEmpty]) return;
|
||||
p = [path currentPoint];
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -354,8 +354,8 @@ very expensive
|
|||
if ([path isEmpty]) return;
|
||||
p = [path currentPoint];
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -381,8 +381,8 @@ very expensive
|
|||
if (!path || [path isEmpty]) return;
|
||||
p = [path currentPoint];
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
[(id<FTFontInfo>)font
|
||||
drawString: s
|
||||
at: x:y
|
||||
|
@ -409,8 +409,8 @@ very expensive
|
|||
if (!path || [path isEmpty]) return;
|
||||
p = [path currentPoint];
|
||||
|
||||
x = p.x;
|
||||
y = wi->sy - p.y;
|
||||
x = p.x - offset.x;
|
||||
y = offset.y - p.y;
|
||||
if (wi->has_alpha)
|
||||
{
|
||||
[(id<FTFontInfo>)font
|
||||
|
|
|
@ -259,7 +259,7 @@ typedef struct
|
|||
} rect_trace_t;
|
||||
|
||||
static void _rect_setup(rect_trace_t *t, NSRect r, int cx0, int cx1,
|
||||
NSAffineTransform *ctm, int up, int *y0, int wi_sy)
|
||||
NSAffineTransform *ctm, int up, int *y0, NSPoint offset)
|
||||
{
|
||||
float fx[4], fy[4];
|
||||
NSPoint p;
|
||||
|
@ -289,10 +289,10 @@ static void _rect_setup(rect_trace_t *t, NSRect r, int cx0, int cx1,
|
|||
if (fabs(fy[2] - floor(fy[2] + .5)) < 0.001) fy[2] = floor(fy[2] + .5);
|
||||
if (fabs(fy[3] - floor(fy[3] + .5)) < 0.001) fy[3] = floor(fy[3] + .5);
|
||||
|
||||
t->x[0] = floor(fx[0]); t->y[0] = wi_sy - floor(fy[0]);
|
||||
t->x[1] = floor(fx[1]); t->y[1] = wi_sy - floor(fy[1]);
|
||||
t->x[2] = floor(fx[2]); t->y[2] = wi_sy - floor(fy[2]);
|
||||
t->x[3] = floor(fx[3]); t->y[3] = wi_sy - floor(fy[3]);
|
||||
t->x[0] = floor(fx[0]) - offset.x; t->y[0] = offset.y - floor(fy[0]);
|
||||
t->x[1] = floor(fx[1]) - offset.x; t->y[1] = offset.y - floor(fy[1]);
|
||||
t->x[2] = floor(fx[2]) - offset.x; t->y[2] = offset.y - floor(fy[2]);
|
||||
t->x[3] = floor(fx[3]) - offset.x; t->y[3] = offset.y - floor(fy[3]);
|
||||
|
||||
/* If we're tracing the 'other way', we just flip the y-coordinates
|
||||
and unflip when returning them */
|
||||
|
@ -493,11 +493,11 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
cy1 = clip_y1;
|
||||
|
||||
sp = [ags->ctm pointInMatrixSpace: aRect.origin];
|
||||
sp.x = floor(sp.x);
|
||||
sp.y = floor(ags->wi->sy - sp.y);
|
||||
sp.x = floor(sp.x - ags->offset.x);
|
||||
sp.y = floor(ags->offset.y - sp.y);
|
||||
dp = [ctm pointInMatrixSpace: aPoint];
|
||||
dp.x = floor(dp.x);
|
||||
dp.y = floor(wi->sy - dp.y);
|
||||
dp.x = floor(dp.x - offset.x);
|
||||
dp.y = floor(offset.y - dp.y);
|
||||
|
||||
if (dp.x - cx0 > sp.x)
|
||||
cx0 = dp.x - sp.x;
|
||||
|
@ -613,7 +613,7 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
{
|
||||
int ry;
|
||||
int x0, x1;
|
||||
_rect_setup(&state, aRect, sx0, sx0 + cx1, ags->ctm, order, &ry, ags->wi->sy);
|
||||
_rect_setup(&state, aRect, sx0, sx0 + cx1, ags->ctm, order, &ry, ags->offset);
|
||||
if (order)
|
||||
{
|
||||
if (ry < sy0)
|
||||
|
@ -875,11 +875,11 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
cy1 = clip_y1;
|
||||
|
||||
sp = [ags->ctm pointInMatrixSpace: aRect.origin];
|
||||
sp.x = floor(sp.x);
|
||||
sp.y = floor(ags->wi->sy - sp.y);
|
||||
sp.x = floor(sp.x - ags->offset.x);
|
||||
sp.y = floor(ags->offset.y - sp.y);
|
||||
dp = [ctm pointInMatrixSpace: aPoint];
|
||||
dp.x = floor(dp.x);
|
||||
dp.y = floor(wi->sy - dp.y);
|
||||
dp.x = floor(dp.x - offset.x);
|
||||
dp.y = floor(offset.y - dp.y);
|
||||
|
||||
if (dp.x - cx0 > sp.x)
|
||||
cx0 = dp.x - sp.x;
|
||||
|
@ -987,7 +987,7 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
{
|
||||
int ry;
|
||||
int x0, x1;
|
||||
_rect_setup(&state, aRect, sx0, sx0 + cx1, ags->ctm, order, &ry, ags->wi->sy);
|
||||
_rect_setup(&state, aRect, sx0, sx0 + cx1, ags->ctm, order, &ry, ags->offset);
|
||||
if (order)
|
||||
{
|
||||
if (ry < sy0)
|
||||
|
@ -1254,7 +1254,7 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
{
|
||||
int ry;
|
||||
int x0, x1;
|
||||
_rect_setup(&state, aRect, cx0, cx0 + cx1, ctm, 0, &ry, wi->sy);
|
||||
_rect_setup(&state, aRect, cx0, cx0 + cx1, ctm, 0, &ry, offset);
|
||||
if (ry >= cy0 + cy1)
|
||||
return;
|
||||
delta = ry - cy0;
|
||||
|
|
|
@ -248,10 +248,10 @@ seem to cause edges to be off by a pixel
|
|||
if (fabs(fy[2] - floor(fy[2] + .5)) < 0.001) fy[2] = floor(fy[2] + .5);
|
||||
if (fabs(fy[3] - floor(fy[3] + .5)) < 0.001) fy[3] = floor(fy[3] + .5);
|
||||
|
||||
x[0] = floor(fx[0]); y[0] = wi->sy - floor(fy[0]);
|
||||
x[1] = floor(fx[1]); y[1] = wi->sy - floor(fy[1]);
|
||||
x[2] = floor(fx[2]); y[2] = wi->sy - floor(fy[2]);
|
||||
x[3] = floor(fx[3]); y[3] = wi->sy - floor(fy[3]);
|
||||
x[0] = floor(fx[0]) - offset.x; y[0] = offset.y - floor(fy[0]);
|
||||
x[1] = floor(fx[1]) - offset.x; y[1] = offset.y - floor(fy[1]);
|
||||
x[2] = floor(fx[2]) - offset.x; y[2] = offset.y - floor(fy[2]);
|
||||
x[3] = floor(fx[3]) - offset.x; y[3] = offset.y - floor(fy[3]);
|
||||
|
||||
tx[0] = 0; ty[0] = ii->height;
|
||||
tx[1] = ii->width; ty[1] = ii->height;
|
||||
|
@ -626,8 +626,8 @@ seem to cause edges to be off by a pixel
|
|||
else
|
||||
alpha_dest = NULL;
|
||||
|
||||
ox = [matrix transformPoint: NSMakePoint(0, 0)].x;
|
||||
oy = wi->sy - [matrix transformPoint: NSMakePoint(0, 0)].y - pixelsHigh;
|
||||
ox = [matrix transformPoint: NSMakePoint(0, 0)].x - offset.x;
|
||||
oy = offset.y - [matrix transformPoint: NSMakePoint(0, 0)].y - pixelsHigh;
|
||||
|
||||
for (y = 0; y < pixelsHigh; y++)
|
||||
{
|
||||
|
|
|
@ -413,8 +413,8 @@ within one pixel.) */
|
|||
matrix[1]=-ctm->matrix.m12;
|
||||
matrix[2]= ctm->matrix.m21;
|
||||
matrix[3]=-ctm->matrix.m22;
|
||||
matrix[4]= ctm->matrix.tX;
|
||||
matrix[5]=-ctm->matrix.tY + wi->sy;
|
||||
matrix[4]= ctm->matrix.tX - offset.x;
|
||||
matrix[5]=-ctm->matrix.tY + offset.y;
|
||||
|
||||
/* If the matrix is 'inverted', ie. if the determinant is negative,
|
||||
we need to flip the order of the vertices. Since it's a rectangle
|
||||
|
@ -622,8 +622,8 @@ within one pixel.) */
|
|||
matrix[1]= 0;
|
||||
matrix[2]= 0;
|
||||
matrix[3]=-1;
|
||||
matrix[4]= 0;
|
||||
matrix[5]= wi->sy;
|
||||
matrix[4]= 0 - offset.x;
|
||||
matrix[5]= offset.y;
|
||||
|
||||
bp2 = art_bpath_affine_transform(bpath, matrix);
|
||||
art_free(bpath);
|
||||
|
@ -1295,8 +1295,8 @@ static void clip_svp_callback(void *data, int y, int start,
|
|||
matrix[1] =-ctm->matrix.m12;
|
||||
matrix[2] = ctm->matrix.m21;
|
||||
matrix[3] =-ctm->matrix.m22;
|
||||
matrix[4] = ctm->matrix.tX;
|
||||
matrix[5] =-ctm->matrix.tY + wi->sy;
|
||||
matrix[4] = ctm->matrix.tX - offset.x;
|
||||
matrix[5] =-ctm->matrix.tY + offset.y;
|
||||
|
||||
vp2 = art_vpath_affine_transform(vp, matrix);
|
||||
art_free(vp);
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef struct
|
|||
} rect_trace_t;
|
||||
|
||||
static void _rect_setup(rect_trace_t *t, NSRect r, int cx0, int cx1,
|
||||
NSAffineTransform *ctm, int up, int *y0, int wi_sy)
|
||||
NSAffineTransform *ctm, int up, int *y0, NSPoint offset)
|
||||
{
|
||||
float fx[4], fy[4];
|
||||
NSPoint p;
|
||||
|
@ -91,10 +91,10 @@ static void _rect_setup(rect_trace_t *t, NSRect r, int cx0, int cx1,
|
|||
if (fabs(fy[2] - floor(fy[2] + .5)) < 0.001) fy[2] = floor(fy[2] + .5);
|
||||
if (fabs(fy[3] - floor(fy[3] + .5)) < 0.001) fy[3] = floor(fy[3] + .5);
|
||||
|
||||
t->x[0] = floor(fx[0]); t->y[0] = wi_sy - floor(fy[0]);
|
||||
t->x[1] = floor(fx[1]); t->y[1] = wi_sy - floor(fy[1]);
|
||||
t->x[2] = floor(fx[2]); t->y[2] = wi_sy - floor(fy[2]);
|
||||
t->x[3] = floor(fx[3]); t->y[3] = wi_sy - floor(fy[3]);
|
||||
t->x[0] = floor(fx[0]) - offset.x; t->y[0] = offset.y - floor(fy[0]);
|
||||
t->x[1] = floor(fx[1]) - offset.x; t->y[1] = offset.y - floor(fy[1]);
|
||||
t->x[2] = floor(fx[2]) - offset.x; t->y[2] = offset.y - floor(fy[2]);
|
||||
t->x[3] = floor(fx[3]) - offset.x; t->y[3] = offset.y - floor(fy[3]);
|
||||
|
||||
/* If we're tracing the 'other way', we just flip the y-coordinates
|
||||
and unflip when returning them */
|
||||
|
@ -628,7 +628,7 @@ static void function_free(function_t *f)
|
|||
dst=wi->data+wi->bytes_per_line*clip_y0+clip_x0*DI.bytes_per_pixel;
|
||||
dsta=wi->alpha+wi->sx*clip_y0+clip_x0;
|
||||
|
||||
_rect_setup(&rt,rect,clip_x0,clip_x1,matrix,0,&y,wi->sy);
|
||||
_rect_setup(&rt,rect,clip_x0,clip_x1,matrix,0,&y,offset);
|
||||
|
||||
while (y<clip_y0)
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ static void function_free(function_t *f)
|
|||
r.dst=dst+x0*DI.bytes_per_pixel;
|
||||
r.dsta=dsta+x0;
|
||||
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0,wi->sy-y)];
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0-offset.x,offset.y-y)];
|
||||
in[0]=p.x;
|
||||
in[1]=p.y;
|
||||
|
||||
|
@ -695,7 +695,7 @@ static void function_free(function_t *f)
|
|||
{
|
||||
if (state)
|
||||
{
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0,wi->sy-y)];
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0-offset.x,offset.y-y)];
|
||||
in[0]=p.x;
|
||||
in[1]=p.y;
|
||||
|
||||
|
@ -728,7 +728,7 @@ static void function_free(function_t *f)
|
|||
}
|
||||
if (state)
|
||||
{
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0,wi->sy-y)];
|
||||
p=[inverse transformPoint: NSMakePoint(clip_x0+x0-offset.y,offset.y-y)];
|
||||
in[0]=p.x;
|
||||
in[1]=p.y;
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
|
|
@ -158,6 +158,11 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
return 0;
|
||||
}
|
||||
|
||||
@interface XGServer (WindowOps)
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style : (Window) win;
|
||||
@end
|
||||
|
||||
@implementation XGServer (EventOps)
|
||||
|
||||
- (int) XGErrorHandler: (Display*)display : (XErrorEvent*)err
|
||||
|
@ -296,6 +301,25 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
- (NSPoint) _XPointToOSPoint: (NSPoint)x for: (void*)window
|
||||
{
|
||||
gswindow_device_t *win = (gswindow_device_t*)window;
|
||||
unsigned int style = win->win_attrs.window_style;
|
||||
NSPoint o;
|
||||
float t, b, l, r;
|
||||
|
||||
[self styleoffsets: &l : &r : &t : &b : style : win->ident];
|
||||
o.x = x.x + l;
|
||||
o.y = NSHeight(win->xframe) - x.y + b;
|
||||
|
||||
NSDebugLLog(@"Frame", @"X2OP %d, %x, %@, %@", win->number, style,
|
||||
NSStringFromPoint(x), NSStringFromPoint(o));
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
- (void) processEvent: (XEvent *) event
|
||||
{
|
||||
static int clickCount = 1;
|
||||
|
@ -322,21 +346,21 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
xEvent.xbutton.window, xEvent.xbutton.time,
|
||||
generic.lastClick);
|
||||
/*
|
||||
* hardwired test for a double click
|
||||
*
|
||||
* For multiple clicks, the clicks must remain in the same
|
||||
* region of the same window and must occur in a limited time.
|
||||
*
|
||||
* default time of 300 should be user set;
|
||||
* perhaps the movement of 3 should also be a preference?
|
||||
*/
|
||||
* hardwired test for a double click
|
||||
*
|
||||
* For multiple clicks, the clicks must remain in the same
|
||||
* region of the same window and must occur in a limited time.
|
||||
*
|
||||
* default time of 300 should be user set;
|
||||
* perhaps the movement of 3 should also be a preference?
|
||||
*/
|
||||
{
|
||||
BOOL incrementCount = YES;
|
||||
|
||||
#define CLICK_TIME 300
|
||||
#define CLICK_MOVE 3
|
||||
#define CLICK_TIME 300
|
||||
#define CLICK_MOVE 3
|
||||
if (xEvent.xbutton.time
|
||||
>= (unsigned long)(generic.lastClick + CLICK_TIME))
|
||||
>= (unsigned long)(generic.lastClick + CLICK_TIME))
|
||||
incrementCount = NO;
|
||||
else if (generic.lastClickWindow != xEvent.xbutton.window)
|
||||
incrementCount = NO;
|
||||
|
@ -385,7 +409,7 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
eventType = NSScrollWheel;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.downMouse
|
||||
&& generic.downMouse != 0)
|
||||
&& generic.downMouse != 0)
|
||||
{
|
||||
deltaY = -1.;
|
||||
eventType = NSScrollWheel;
|
||||
|
@ -403,7 +427,9 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
if (cWin == 0)
|
||||
break;
|
||||
eventLocation.x = xEvent.xbutton.x;
|
||||
eventLocation.y = NSHeight(cWin->xframe)-xEvent.xbutton.y;
|
||||
eventLocation.y = xEvent.xbutton.y;
|
||||
eventLocation = [self _XPointToOSPoint: eventLocation
|
||||
for: cWin];
|
||||
|
||||
if (generic.flags.useWindowMakerIcons == 1)
|
||||
{
|
||||
|
@ -468,7 +494,9 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
if (cWin == 0)
|
||||
break;
|
||||
eventLocation.x = xEvent.xbutton.x;
|
||||
eventLocation.y = NSHeight(cWin->xframe)-xEvent.xbutton.y;
|
||||
eventLocation.y = xEvent.xbutton.y;
|
||||
eventLocation = [self _XPointToOSPoint: eventLocation
|
||||
for: cWin];
|
||||
|
||||
e = [NSEvent mouseEventWithType: eventType
|
||||
location: eventLocation
|
||||
|
@ -609,8 +637,8 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
NSMinX(cWin->xframe);
|
||||
eventLocation.y = XDND_POSITION_ROOT_Y(&xEvent) -
|
||||
NSMinY(cWin->xframe);
|
||||
eventLocation.y = NSHeight(cWin->xframe) -
|
||||
eventLocation.y;
|
||||
eventLocation = [self _XPointToOSPoint: eventLocation
|
||||
for: cWin];
|
||||
time = XDND_POSITION_TIME(&xEvent);
|
||||
action = XDND_POSITION_ACTION(&xEvent);
|
||||
operation = GSDragOperationForAction(action);
|
||||
|
@ -1218,8 +1246,9 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
|||
|
||||
deltaX = - eventLocation.x;
|
||||
deltaY = - eventLocation.y;
|
||||
eventLocation = NSMakePoint(xEvent.xmotion.x,
|
||||
NSHeight(cWin->xframe) - xEvent.xmotion.y);
|
||||
eventLocation = NSMakePoint(xEvent.xmotion.x, xEvent.xmotion.y);
|
||||
eventLocation = [self _XPointToOSPoint: eventLocation
|
||||
for: cWin];
|
||||
deltaX += eventLocation.x;
|
||||
deltaY += eventLocation.y;
|
||||
|
||||
|
@ -1626,14 +1655,12 @@ process_key_event (XEvent* xEvent, XGServer* context, NSEventType eventType)
|
|||
|
||||
/* Process location */
|
||||
window = [XGServer _windowWithTag: [[NSApp keyWindow] windowNumber]];
|
||||
eventLocation.x = xEvent->xbutton.x;
|
||||
if (window)
|
||||
{
|
||||
eventLocation.y = window->siz_hints.height - xEvent->xbutton.y;
|
||||
}
|
||||
else
|
||||
if (window != 0)
|
||||
{
|
||||
eventLocation.x = xEvent->xbutton.x;
|
||||
eventLocation.y = xEvent->xbutton.y;
|
||||
eventLocation = [context _XPointToOSPoint: eventLocation
|
||||
for: window];
|
||||
}
|
||||
|
||||
/* Process characters */
|
||||
|
|
|
@ -450,19 +450,22 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
|||
|
||||
/*
|
||||
* Convert a rectangle in X coordinates relative to the X-window
|
||||
* to a rectangle in OpenStep coordinates in the topmost view in the
|
||||
* NSWindow.
|
||||
* to a rectangle in OpenStep coordinates (base coordinates of the NSWindow).
|
||||
*/
|
||||
- (NSRect) _XWinRectToOSViewRect: (NSRect)x for: (void*)window
|
||||
- (NSRect) _XWinRectToOSWinRect: (NSRect)x for: (void*)window
|
||||
{
|
||||
gswindow_device_t *win = (gswindow_device_t*)window;
|
||||
unsigned int style = win->win_attrs.window_style;
|
||||
NSRect o;
|
||||
float t, b, l, r;
|
||||
|
||||
[self styleoffsets: &l : &r : &t : &b : style : win->ident];
|
||||
o.size.width = x.size.width;
|
||||
o.size.height = x.size.height;
|
||||
o.origin.x = x.origin.x;
|
||||
o.origin.y = win->siz_hints.height - x.origin.y;
|
||||
o.origin.y = o.origin.y - o.size.height;
|
||||
NSDebugLLog(@"Frame", @"XW2OV %@ %@",
|
||||
o.origin.x = x.origin.x - l;
|
||||
o.origin.y = NSHeight(win->xframe) - x.origin.y;
|
||||
o.origin.y = o.origin.y - x.size.height - b;
|
||||
NSDebugLLog(@"Frame", @"XW2OW %@ %@",
|
||||
NSStringFromRect(x), NSStringFromRect(o));
|
||||
return o;
|
||||
}
|
||||
|
@ -1847,6 +1850,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
|||
unsigned width, height;
|
||||
gswindow_device_t *window;
|
||||
NSGraphicsContext *ctxt;
|
||||
float t, b, l, r;
|
||||
|
||||
NSDebugLLog(@"XGTrace", @"DPSwindowdevice: %d ", win);
|
||||
window = WINDOW_WITH_TAG(win);
|
||||
|
@ -1863,8 +1867,8 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
|||
height = NSHeight(window->xframe);
|
||||
|
||||
if (window->buffer
|
||||
&& (window->buffer_width != width || window->buffer_height != height)
|
||||
&& (window->gdriverProtocol & GDriverHandlesBacking) == 0)
|
||||
&& (window->buffer_width != width || window->buffer_height != height)
|
||||
&& (window->gdriverProtocol & GDriverHandlesBacking) == 0)
|
||||
{
|
||||
[isa waitAllContexts];
|
||||
XFreePixmap(dpy, window->buffer);
|
||||
|
@ -1883,8 +1887,11 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
|||
}
|
||||
|
||||
ctxt = GSCurrentContext();
|
||||
GSSetDevice(ctxt, window, 0, NSHeight(window->xframe));
|
||||
[self styleoffsets: &l : &r : &t : &b
|
||||
: window->win_attrs.window_style : window->ident];
|
||||
GSSetDevice(ctxt, window, l, NSHeight(window->xframe) + b);
|
||||
DPSinitmatrix(ctxt);
|
||||
//DPStranslate(ctxt, -l, -b);
|
||||
DPSinitclip(ctxt);
|
||||
}
|
||||
|
||||
|
@ -2638,7 +2645,7 @@ static BOOL didCreatePixmaps;
|
|||
// Transform the rectangle's coordinates to OS coordinates and add
|
||||
// this new rectangle to the list of exposed rectangles.
|
||||
{
|
||||
rect = [self _XWinRectToOSViewRect: NSMakeRect(
|
||||
rect = [self _XWinRectToOSWinRect: NSMakeRect(
|
||||
rectangle.x, rectangle.y, rectangle.width, rectangle.height)
|
||||
for: window];
|
||||
[window->exposedRects addObject: [NSValue valueWithRect: rect]];
|
||||
|
@ -2738,7 +2745,7 @@ static BOOL didCreatePixmaps;
|
|||
NSValue *val[n];
|
||||
int i;
|
||||
|
||||
v = [gui_win _windowView];
|
||||
v = [[gui_win contentView] superview];
|
||||
|
||||
[window->exposedRects getObjects: val];
|
||||
for (i = 0; i < n; ++i)
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
Loading…
Reference in a new issue