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
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>
* 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. */
- (NSArray *)screenList
{
NSArray *screens;
NSMutableArray *tmpScreens;
int i;
monitorsCount = 0;
if (monitors != NULL) {
NSZoneFree([self zone], monitors);
@ -4460,26 +4456,30 @@ _computeDepth(int class, int bpp)
#ifdef HAVE_XRANDR
XRRScreenResources *screen_res;
RROutput primary_output;
XRROutputInfo *output_info;
XRRCrtcInfo *crtc_info;
int mi;
NSRect frame;
int xScreenHeight = DisplayHeight(dpy, defScreen);
Window root = [self xDisplayRootWindow];
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, defScreen));
screen_res = XRRGetScreenResources(dpy, root);
if (screen_res != NULL)
{
RROutput primary_output;
NSMutableArray *tmpScreens;
int i;
int mi;
monitorsCount = screen_res->noutput;
tmpScreens = [NSMutableArray arrayWithCapacity: monitorsCount];
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++)
{
XRROutputInfo *output_info;
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[i]);
if (output_info->crtc)
{
XRRCrtcInfo *crtc_info;
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
monitors[mi].screen_id = defScreen;
@ -4493,7 +4493,7 @@ _computeDepth(int class, int bpp)
crtc_info->height);
monitors[mi].frame = frame;
/* 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. */
if (screen_res->outputs[i] == primary_output)
{
@ -4503,31 +4503,28 @@ _computeDepth(int class, int bpp)
{
[tmpScreens addObject: [NSNumber numberWithInt: mi]];
}
XRRFreeCrtcInfo(crtc_info);
mi++;
}
XRRFreeOutputInfo(output_info);
}
XRRFreeScreenResources(screen_res);
screens = [NSArray arrayWithArray: tmpScreens];
return [NSArray arrayWithArray: tmpScreens];
}
#endif
if (monitorsCount == 0)
{
/* 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
`defScreen`. */
monitorsCount = 1;
monitors = NSZoneMalloc([self zone], sizeof(MonitorDevice));
monitors[0].screen_id = defScreen;
monitors[0].depth = [self windowDepthForScreen: 0];
monitors[0].resolution = [self resolutionForScreen: defScreen];
monitors[0].frame = NSMakeRect(0, 0,
DisplayWidth(dpy, defScreen),
DisplayHeight(dpy, defScreen));
screens = [NSArray arrayWithObject: [NSNumber numberWithInt: defScreen]];
}
return screens;
/* 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
`defScreen`. */
monitorsCount = 1;
monitors = NSZoneMalloc([self zone], sizeof(MonitorDevice));
monitors[0].screen_id = defScreen;
monitors[0].depth = [self windowDepthForScreen: 0];
monitors[0].resolution = [self resolutionForScreen: defScreen];
monitors[0].frame = NSMakeRect(0, 0,
DisplayWidth(dpy, defScreen),
DisplayHeight(dpy, defScreen));
return [NSArray arrayWithObject: [NSNumber numberWithInt: 0]];
}
// `screen` is a monitor index not X11 screen

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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