Merge branch 'master' into randr

Conflicts:
	ChangeLog
	Source/x11/XGServerWindow.m
This commit is contained in:
Sergii Stoian 2020-02-11 23:38:52 +02:00
commit 2fdced823c
8 changed files with 59 additions and 48 deletions

View file

@ -5,6 +5,20 @@
systems. After this change windows and screen will use the same start systems. After this change windows and screen will use the same start
of coordinate system for their origins. of coordinate system for their origins.
2020-02-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/xlib/GSXftFontInfo.m,
* Source/xlib/XGFont.m,
* Source/xlib/XGFontManager.m,
* Source/xlib/XGFontSetFontInfo.m,
* Source/xlib/XGGState.m,
* Source/xlib/XGGeometry.m : Fixes after Xrandr change to get xlib
backend to compile again.
2020-02-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (screenList): Clean up implementation.
2020-02-07 Sergii Stoian <stoyan255@gmail.com> 2020-02-07 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (_XFrameToOSFrame:for:): use Xlib * Source/x11/XGServerWindow.m (_XFrameToOSFrame:for:): use Xlib

View file

@ -4448,10 +4448,6 @@ _computeDepth(int class, int bpp)
We map XRandR monitors (outputs) to NSScreen. */ We map XRandR monitors (outputs) to NSScreen. */
- (NSArray *)screenList - (NSArray *)screenList
{ {
NSArray *screens;
NSMutableArray *tmpScreens;
int i;
monitorsCount = 0; monitorsCount = 0;
if (monitors != NULL) { if (monitors != NULL) {
NSZoneFree([self zone], monitors); NSZoneFree([self zone], monitors);
@ -4460,26 +4456,30 @@ _computeDepth(int class, int bpp)
#ifdef HAVE_XRANDR #ifdef HAVE_XRANDR
XRRScreenResources *screen_res; XRRScreenResources *screen_res;
RROutput primary_output; Window root = [self xDisplayRootWindow];
XRROutputInfo *output_info;
XRRCrtcInfo *crtc_info;
int mi;
NSRect frame;
int xScreenHeight = DisplayHeight(dpy, defScreen);
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, defScreen)); screen_res = XRRGetScreenResources(dpy, root);
if (screen_res != NULL) if (screen_res != NULL)
{ {
RROutput primary_output;
NSMutableArray *tmpScreens;
int i;
int mi;
monitorsCount = screen_res->noutput; monitorsCount = screen_res->noutput;
tmpScreens = [NSMutableArray arrayWithCapacity: monitorsCount]; tmpScreens = [NSMutableArray arrayWithCapacity: monitorsCount];
monitors = NSZoneMalloc([self zone], monitorsCount * sizeof(MonitorDevice)); monitors = NSZoneMalloc([self zone], monitorsCount * sizeof(MonitorDevice));
primary_output = XRRGetOutputPrimary(dpy, root);
primary_output = XRRGetOutputPrimary(dpy, [self xDisplayRootWindow]);
for (i = 0, mi = 0; i < screen_res->noutput; i++) for (i = 0, mi = 0; i < screen_res->noutput; i++)
{ {
XRROutputInfo *output_info;
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[i]); output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[i]);
if (output_info->crtc) if (output_info->crtc)
{ {
XRRCrtcInfo *crtc_info;
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc); crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
monitors[mi].screen_id = defScreen; monitors[mi].screen_id = defScreen;
@ -4493,7 +4493,7 @@ _computeDepth(int class, int bpp)
crtc_info->height); crtc_info->height);
monitors[mi].frame = frame; monitors[mi].frame = frame;
/* Add monitor ID (index in monitors array). /* Add monitor ID (index in monitors array).
Put primary monitor ID index 0 since NSScreen get this as main Put primary monitor ID at index 0 since NSScreen get this as main
screen if application has no key window. */ screen if application has no key window. */
if (screen_res->outputs[i] == primary_output) if (screen_res->outputs[i] == primary_output)
{ {
@ -4503,16 +4503,16 @@ _computeDepth(int class, int bpp)
{ {
[tmpScreens addObject: [NSNumber numberWithInt: mi]]; [tmpScreens addObject: [NSNumber numberWithInt: mi]];
} }
XRRFreeCrtcInfo(crtc_info);
mi++; mi++;
} }
XRRFreeOutputInfo(output_info);
} }
XRRFreeScreenResources(screen_res); XRRFreeScreenResources(screen_res);
screens = [NSArray arrayWithArray: tmpScreens]; return [NSArray arrayWithArray: tmpScreens];
} }
#endif #endif
if (monitorsCount == 0)
{
/* It is assumed that there is always only one screen per application. /* It is assumed that there is always only one screen per application.
We only need to know its number and it was saved in _initXContext as We only need to know its number and it was saved in _initXContext as
`defScreen`. */ `defScreen`. */
@ -4524,10 +4524,7 @@ _computeDepth(int class, int bpp)
monitors[0].frame = NSMakeRect(0, 0, monitors[0].frame = NSMakeRect(0, 0,
DisplayWidth(dpy, defScreen), DisplayWidth(dpy, defScreen),
DisplayHeight(dpy, defScreen)); DisplayHeight(dpy, defScreen));
screens = [NSArray arrayWithObject: [NSNumber numberWithInt: defScreen]]; return [NSArray arrayWithObject: [NSNumber numberWithInt: 0]];
}
return screens;
} }
// `screen` is a monitor index not X11 screen // `screen` is a monitor index not X11 screen

View file

@ -102,7 +102,7 @@
- (void) dealloc - (void) dealloc
{ {
if (font_info != NULL) if (font_info != NULL)
XftFontClose([XGServer currentXDisplay], (XftFont *)font_info); XftFontClose([XGServer xDisplay], (XftFont *)font_info);
[super dealloc]; [super dealloc];
} }
@ -113,7 +113,7 @@
XftChar16 str[len]; XftChar16 str[len];
[string getCharacters: (unichar*)str]; [string getCharacters: (unichar*)str];
XftTextExtents16 ([XGServer currentXDisplay], XftTextExtents16 ([XGServer xDisplay],
font_info, font_info,
str, str,
len, len,
@ -133,7 +133,7 @@
buf[i] = glyphs[i]; buf[i] = glyphs[i];
} }
XftTextExtents16 ([XGServer currentXDisplay], XftTextExtents16 ([XGServer xDisplay],
font_info, font_info,
buf, buf,
len, len,
@ -193,7 +193,7 @@
- (BOOL) glyphIsEncoded: (NSGlyph)glyph - (BOOL) glyphIsEncoded: (NSGlyph)glyph
{ {
return XftGlyphExists([XGServer currentXDisplay], return XftGlyphExists([XGServer xDisplay],
(XftFont *)font_info, glyph); (XftFont *)font_info, glyph);
} }
@ -229,7 +229,7 @@
/* /*
- (CGFloat) pointSize - (CGFloat) pointSize
{ {
Display *xdpy = [XGServer currentXDisplay]; Display *xdpy = [XGServer xDisplay];
return XGFontPointSize(xdpy, font_info); return XGFontPointSize(xdpy, font_info);
} }
@ -302,14 +302,14 @@
#ifdef HAVE_UTF8 #ifdef HAVE_UTF8
if (mostCompatibleStringEncoding == NSUTF8StringEncoding) if (mostCompatibleStringEncoding == NSUTF8StringEncoding)
XftTextExtentsUtf8([XGServer currentXDisplay], XftTextExtentsUtf8([XGServer xDisplay],
font_info, font_info,
(XftChar8 *)s, (XftChar8 *)s,
len, len,
&extents); &extents);
else else
#endif #endif
XftTextExtents8([XGServer currentXDisplay], XftTextExtents8([XGServer xDisplay],
font_info, font_info,
(XftChar8*)s, (XftChar8*)s,
len, len,
@ -438,7 +438,7 @@ static FT_Outline_Funcs bezierpath_funcs = {
glyph = glyphs[i]; glyph = glyphs[i];
// FIXME: Should do this conversion in the glyph creation! // FIXME: Should do this conversion in the glyph creation!
glyph = XftCharIndex([XGServer currentXDisplay], glyph = XftCharIndex([XGServer xDisplay],
(XftFont *)font_info, glyph); (XftFont *)font_info, glyph);
if (FT_Load_Glyph(face, glyph, load_flags)) if (FT_Load_Glyph(face, glyph, load_flags))
@ -477,7 +477,7 @@ static FT_Outline_Funcs bezierpath_funcs = {
- (BOOL) setupAttributes - (BOOL) setupAttributes
{ {
Display *xdpy = [XGServer currentXDisplay]; Display *xdpy = [XGServer xDisplay];
int defaultScreen = DefaultScreen(xdpy); int defaultScreen = DefaultScreen(xdpy);
GSXftFaceInfo *realFont = [GSXftFontEnumerator fontWithName: fontName]; GSXftFaceInfo *realFont = [GSXftFontEnumerator fontWithName: fontName];
@ -547,7 +547,7 @@ static FT_Outline_Funcs bezierpath_funcs = {
{ {
static XGlyphInfo glyphInfo; static XGlyphInfo glyphInfo;
XftTextExtents32 ([XGServer currentXDisplay], XftTextExtents32 ([XGServer xDisplay],
(XftFont *)font_info, (XftFont *)font_info,
&glyph, &glyph,
1, 1,

View file

@ -129,7 +129,7 @@ static BOOL XGInitAtoms(Display *dpy)
{ {
if (font_info != NULL) if (font_info != NULL)
{ {
XFreeFont([XGServer currentXDisplay], font_info); XFreeFont([XGServer xDisplay], font_info);
} }
[super dealloc]; [super dealloc];
} }
@ -272,7 +272,7 @@ static BOOL XGInitAtoms(Display *dpy)
- (BOOL) setupAttributes - (BOOL) setupAttributes
{ {
Display *xdpy = [XGServer currentXDisplay]; Display *xdpy = [XGServer xDisplay];
NSString *reg; NSString *reg;
long height; long height;
NSString *xfontname; NSString *xfontname;

View file

@ -80,7 +80,7 @@ cache_name()
{ {
NSFileManager *mgr; NSFileManager *mgr;
BOOL flag; BOOL flag;
Display *dpy = [XGServer currentXDisplay]; Display *dpy = [XGServer xDisplay];
NSString *file_name; NSString *file_name;
NSArray *paths; NSArray *paths;
NSString *path = nil; NSString *path = nil;

View file

@ -32,7 +32,7 @@
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
#define XSERVER [XGServer currentXDisplay] #define XSERVER [XGServer xDisplay]
typedef struct _UTF8Str { typedef struct _UTF8Str {
char *data; char *data;

View file

@ -186,8 +186,8 @@ static Region emptyRegion;
/* We know the current server sent us this */ /* We know the current server sent us this */
srv = (XGServer *)GSCurrentServer(); srv = (XGServer *)GSCurrentServer();
context = [srv xrContextForScreen: gs_win->screen]; context = [srv screenRContext];
drawMechanism = [srv drawMechanismForScreen: gs_win->screen]; drawMechanism = [srv screenDrawMechanism];
if (gs_win != NULL && gs_win->alpha_buffer != 0) if (gs_win != NULL && gs_win->alpha_buffer != 0)
{ {

View file

@ -46,7 +46,7 @@
XRectangle XRectangle
accessibleRectForWindow (gswindow_device_t* win) accessibleRectForWindow (gswindow_device_t* win)
{ {
Display* xdpy = [XGServer currentXDisplay]; Display* xdpy = [XGServer xDisplay];
Window root; Window root;
Window ignoreWindow; Window ignoreWindow;
int x, y; int x, y;