mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 06:02:36 +00:00
Revert "(dispserv_x11.c) Cleanups"
This reverts commit e27b314afbb2eb9dde3c5e7918c35e39aeb486e6.
This commit is contained in:
parent
6fd1485c34
commit
a21d09addc
@ -89,15 +89,12 @@ static void x11_display_server_close_display(Display *dpy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool x11_display_server_set_resolution(void *data,
|
static bool x11_display_server_set_resolution(void *data,
|
||||||
unsigned width, unsigned height, int int_hz,
|
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset, int padjust)
|
||||||
float hz, int center, int monitor_index,
|
|
||||||
int xoffset, int padjust)
|
|
||||||
{
|
{
|
||||||
int m;
|
int screen;
|
||||||
XRRScreenResources *resources;
|
Window window;
|
||||||
XRRModeInfo *swmode = NULL;
|
|
||||||
XRRModeInfo *crt_xrrmode = NULL;
|
|
||||||
XRRScreenResources *res = NULL;
|
XRRScreenResources *res = NULL;
|
||||||
|
Display *dpy = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int hfp = 0;
|
int hfp = 0;
|
||||||
int hsp = 0;
|
int hsp = 0;
|
||||||
@ -114,17 +111,20 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
float pixel_clock = 0;
|
float pixel_clock = 0;
|
||||||
int crt_mode_flag = 0;
|
int crt_mode_flag = 0;
|
||||||
bool crt_exists = false;
|
bool crt_exists = false;
|
||||||
Display *dpy = XOpenDisplay(0);
|
|
||||||
int screen = DefaultScreen(dpy);
|
|
||||||
Window window = RootWindow(dpy, screen);
|
|
||||||
|
|
||||||
g_monitor_index = monitor_index;
|
g_monitor_index = monitor_index;
|
||||||
|
|
||||||
|
XRRScreenResources *resources;
|
||||||
|
|
||||||
crt_en = true;
|
crt_en = true;
|
||||||
crt_name_id += 1;
|
crt_name_id += 1;
|
||||||
|
|
||||||
snprintf(crt_name, sizeof(crt_name), "CRT%d", crt_name_id);
|
snprintf(crt_name, sizeof(crt_name), "CRT%d", crt_name_id);
|
||||||
|
|
||||||
|
|
||||||
|
dpy = XOpenDisplay(0);
|
||||||
|
screen = DefaultScreen(dpy);
|
||||||
|
window = RootWindow(dpy, screen);
|
||||||
|
|
||||||
/* set core refresh from hz */
|
/* set core refresh from hz */
|
||||||
video_monitor_set_refresh_rate(hz);
|
video_monitor_set_refresh_rate(hz);
|
||||||
|
|
||||||
@ -133,9 +133,7 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
{
|
{
|
||||||
hfp = (width * 1.033)+(padjust*2);
|
hfp = (width * 1.033)+(padjust*2);
|
||||||
hbp = (width * 1.225)+(padjust*2);
|
hbp = (width * 1.225)+(padjust*2);
|
||||||
}
|
}else {
|
||||||
else
|
|
||||||
{
|
|
||||||
hfp = ((width * 1.033) + (width / 112))+(padjust*4);
|
hfp = ((width * 1.033) + (width / 112))+(padjust*4);
|
||||||
hbp = ((width * 1.225) + (width /58))+(padjust*4);
|
hbp = ((width * 1.225) + (width /58))+(padjust*4);
|
||||||
xoffset = xoffset*2;
|
xoffset = xoffset*2;
|
||||||
@ -187,13 +185,18 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
|
|
||||||
/* create interlaced newmode from modline variables */
|
/* create interlaced newmode from modline variables */
|
||||||
if (height < 300)
|
if (height < 300)
|
||||||
|
{
|
||||||
crt_mode_flag = 10;
|
crt_mode_flag = 10;
|
||||||
|
}
|
||||||
|
|
||||||
/* create interlaced newmode from modline variables */
|
/* create interlaced newmode from modline variables */
|
||||||
if (height > 300)
|
if (height > 300)
|
||||||
|
{
|
||||||
crt_mode_flag = 26;
|
crt_mode_flag = 26;
|
||||||
strlcpy(old_mode, new_mode, sizeof(old_mode));
|
}
|
||||||
|
snprintf(old_mode, sizeof(old_mode), "%s", new_mode);
|
||||||
/* variable for new mode */
|
/* variable for new mode */
|
||||||
strlcpy(new_mode, crt_name, sizeof(new_mode));
|
snprintf(new_mode, sizeof(new_mode), "%s", crt_name);
|
||||||
|
|
||||||
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
|
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
|
||||||
* add and delete modes */
|
* add and delete modes */
|
||||||
@ -209,19 +212,18 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
crt_rrmode.vSyncStart = vfp;
|
crt_rrmode.vSyncStart = vfp;
|
||||||
crt_rrmode.vSyncEnd = vsp;
|
crt_rrmode.vSyncEnd = vsp;
|
||||||
crt_rrmode.vTotal = vbp;
|
crt_rrmode.vTotal = vbp;
|
||||||
crt_rrmode.modeFlags = crt_mode_flag;
|
crt_rrmode.modeFlags = crt_mode_flag; /* 10 for -hsync -vsync. 26 for -hsync -vsync interlaced */
|
||||||
/* 10 for -hsync -vsync. 26 for -hsync -vsync interlaced */
|
|
||||||
crt_rrmode.hSkew = 0;
|
crt_rrmode.hSkew = 0;
|
||||||
|
|
||||||
crt_xrrmode = &crt_rrmode;
|
XRRModeInfo *crt_xrrmode = &crt_rrmode;
|
||||||
res = XRRGetScreenResources(dpy, window);
|
res = XRRGetScreenResources(dpy, window);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
||||||
|
|
||||||
for (m = 0; m < resources->nmode; m++)
|
for (int m = 0; m < resources->nmode; m++)
|
||||||
{
|
{
|
||||||
if (string_is_equal(resources->modes[m].name, new_mode))
|
if (strcmp(resources->modes[m].name, new_mode) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
crt_exists = true;
|
crt_exists = true;
|
||||||
@ -232,15 +234,19 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
XRRFreeScreenResources(resources);
|
XRRFreeScreenResources(resources);
|
||||||
|
|
||||||
|
|
||||||
if (!crt_exists)
|
if (crt_exists == false)
|
||||||
XRRCreateMode(dpy, window, &crt_rrmode);
|
{
|
||||||
|
RRMode wMode = XRRCreateMode(dpy, window, &crt_rrmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
XRRModeInfo *swmode = NULL;
|
||||||
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
||||||
|
|
||||||
for (m = 0; m < resources->nmode; m++)
|
for (int m = 0; m < resources->nmode; m++)
|
||||||
{
|
{
|
||||||
if (string_is_equal(resources->modes[m].name, new_mode))
|
if (strcmp(resources->modes[m].name, new_mode) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
swmode = &resources->modes[m];
|
swmode = &resources->modes[m];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -252,29 +258,26 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
{
|
{
|
||||||
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[i]);
|
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[i]);
|
||||||
|
|
||||||
|
|
||||||
if (outputs->connection == RR_Connected)
|
if (outputs->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
|
|
||||||
XRRAddOutputMode(dpy, res->outputs[i], swmode->id);
|
XRRAddOutputMode(dpy, res->outputs[i], swmode->id);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
strlcpy(orig_output, outputs->name, sizeof(orig_output));
|
snprintf(orig_output, sizeof(orig_output), "%s", outputs->name);
|
||||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
XRRCrtcInfo *crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
||||||
crtc->mode = swmode->id;
|
crtc->mode = swmode->id;
|
||||||
crtc->width = swmode->width;
|
crtc->width = swmode->width;
|
||||||
crtc->height = swmode->height;
|
crtc->height = swmode->height;
|
||||||
XRRSetCrtcConfig(dpy, res,res->crtcs[i],
|
XRRSetCrtcConfig(dpy, res,res->crtcs[i], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
||||||
CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XRRSetScreenSize(dpy, window, width, height,
|
XRRSetScreenSize(dpy, window, width, height, (int) ((25.4 * width) / 96.0), (int) ((25.4 * height) / 96.0));
|
||||||
(int)((25.4 * width) / 96.0),
|
XRRSetCrtcConfig(dpy, res, res->crtcs[i], CurrentTime, crtc->x, crtc->y, crtc->mode, crtc->rotation, crtc->outputs, crtc->noutput);
|
||||||
(int)((25.4 * height) / 96.0));
|
|
||||||
XRRSetCrtcConfig(dpy, res, res->crtcs[i],
|
|
||||||
CurrentTime, crtc->x, crtc->y, crtc->mode,
|
|
||||||
crtc->rotation, crtc->outputs, crtc->noutput);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
XRRFreeOutputInfo(outputs);
|
XRRFreeOutputInfo(outputs);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XRRFreeScreenResources(resources);
|
XRRFreeScreenResources(resources);
|
||||||
@ -287,23 +290,17 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
|
|
||||||
if (outputs->connection == RR_Connected)
|
if (outputs->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
XRRCrtcInfo *crtc;
|
|
||||||
|
|
||||||
XRRAddOutputMode(dpy, res->outputs[monitor_index], swmode->id);
|
XRRAddOutputMode(dpy, res->outputs[monitor_index], swmode->id);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
strlcpy(orig_output, outputs->name, sizeof(orig_output));
|
snprintf(orig_output, sizeof(orig_output), "%s", outputs->name);
|
||||||
crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
XRRCrtcInfo *crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
||||||
crtc->mode = swmode->id;
|
crtc->mode = swmode->id;
|
||||||
crtc->width = swmode->width;
|
crtc->width = swmode->width;
|
||||||
crtc->height = swmode->height;
|
crtc->height = swmode->height;
|
||||||
XRRSetCrtcConfig(dpy, res,res->crtcs[monitor_index], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
XRRSetCrtcConfig(dpy, res,res->crtcs[monitor_index], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XRRSetScreenSize(dpy, window, width, height,
|
XRRSetScreenSize(dpy, window, width, height, (int) ((25.4 * width) / 96.0), (int) ((25.4 * height) / 96.0));
|
||||||
(int)((25.4 * width) / 96.0),
|
XRRSetCrtcConfig(dpy, res, res->crtcs[monitor_index], CurrentTime, crtc->x, crtc->y, crtc->mode, crtc->rotation, crtc->outputs, crtc->noutput);
|
||||||
(int)((25.4 * height) / 96.0));
|
|
||||||
XRRSetCrtcConfig(dpy, res, res->crtcs[monitor_index],
|
|
||||||
CurrentTime, crtc->x, crtc->y, crtc->mode,
|
|
||||||
crtc->rotation, crtc->outputs, crtc->noutput);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
@ -388,13 +385,9 @@ static void x11_display_server_set_screen_orientation(enum rotation rotation)
|
|||||||
|
|
||||||
crtc->rotation = new_rotation;
|
crtc->rotation = new_rotation;
|
||||||
|
|
||||||
XRRSetScreenSize(dpy, DefaultRootWindow(dpy), crtc->width,
|
XRRSetScreenSize(dpy, DefaultRootWindow(dpy), crtc->width, crtc->height, (25.4 * crtc->width) / dpi, (25.4 * crtc->height) / dpi);
|
||||||
crtc->height, (25.4 * crtc->width) / dpi,
|
|
||||||
(25.4 * crtc->height) / dpi);
|
|
||||||
|
|
||||||
XRRSetCrtcConfig(dpy, screen, screen->crtcs[j], CurrentTime,
|
XRRSetCrtcConfig(dpy, screen, screen->crtcs[j], CurrentTime, crtc->x, crtc->y, crtc->mode, crtc->rotation, crtc->outputs, crtc->noutput);
|
||||||
crtc->x, crtc->y, crtc->mode, crtc->rotation,
|
|
||||||
crtc->outputs, crtc->noutput);
|
|
||||||
|
|
||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
}
|
}
|
||||||
@ -416,12 +409,10 @@ static enum rotation x11_display_server_get_screen_orientation(void)
|
|||||||
XRRScreenConfiguration *config = NULL;
|
XRRScreenConfiguration *config = NULL;
|
||||||
enum rotation rotation = ORIENTATION_NORMAL;
|
enum rotation rotation = ORIENTATION_NORMAL;
|
||||||
Display *dpy = x11_display_server_open_display();
|
Display *dpy = x11_display_server_open_display();
|
||||||
XRRScreenResources *screen = XRRGetScreenResources(dpy,
|
XRRScreenResources *screen = XRRGetScreenResources(dpy, DefaultRootWindow(dpy));
|
||||||
DefaultRootWindow(dpy));
|
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return ORIENTATION_NORMAL;
|
return ORIENTATION_NORMAL;
|
||||||
config = XRRGetScreenInfo(dpy,
|
config = XRRGetScreenInfo(dpy, DefaultRootWindow(dpy));
|
||||||
DefaultRootWindow(dpy));
|
|
||||||
|
|
||||||
for (i = 0; i < screen->noutput; i++)
|
for (i = 0; i < screen->noutput; i++)
|
||||||
{
|
{
|
||||||
@ -489,18 +480,19 @@ static void x11_display_server_destroy(void *data)
|
|||||||
{
|
{
|
||||||
dispserv_x11_t *dispserv = (dispserv_x11_t*)data;
|
dispserv_x11_t *dispserv = (dispserv_x11_t*)data;
|
||||||
#ifdef HAVE_XRANDR
|
#ifdef HAVE_XRANDR
|
||||||
int m;
|
int screen;
|
||||||
XRRModeInfo *swoldmode = NULL;
|
Window window;
|
||||||
XRRModeInfo *swdeskmode = NULL;
|
XRRScreenResources *res = NULL;
|
||||||
XRRScreenResources *resources = NULL;
|
Display *dpy = NULL;
|
||||||
Display *dpy = XOpenDisplay(0);
|
XRRScreenResources *resources;
|
||||||
int screen = DefaultScreen(dpy);
|
dpy = XOpenDisplay(0);
|
||||||
Window window = RootWindow(dpy, screen);
|
screen = DefaultScreen(dpy);
|
||||||
|
window = RootWindow(dpy, screen);
|
||||||
bool crt_exists = false;
|
bool crt_exists = false;
|
||||||
char dmode[25] = {0};
|
char dmode[25] ={};
|
||||||
XRRScreenResources *res = XRRGetScreenResources(dpy, window);
|
|
||||||
|
|
||||||
strlcpy(dmode, "d_mo", sizeof(dmode));
|
|
||||||
|
snprintf(dmode, sizeof(dmode), "%s", "d_mo");
|
||||||
|
|
||||||
crt_rrmode.name = dmode;
|
crt_rrmode.name = dmode;
|
||||||
crt_rrmode.nameLength = strlen(crt_name);
|
crt_rrmode.nameLength = strlen(crt_name);
|
||||||
@ -513,19 +505,23 @@ static void x11_display_server_destroy(void *data)
|
|||||||
crt_rrmode.vSyncStart = 490;
|
crt_rrmode.vSyncStart = 490;
|
||||||
crt_rrmode.vSyncEnd = 496;
|
crt_rrmode.vSyncEnd = 496;
|
||||||
crt_rrmode.vTotal = 533;
|
crt_rrmode.vTotal = 533;
|
||||||
crt_rrmode.modeFlags = 26;
|
crt_rrmode.modeFlags = 26; /* 10 for -hsync -vsync. ?? for -hsync -vsync interlaced */
|
||||||
/* 10 for -hsync -vsync. ?? for -hsync -vsync interlaced */
|
|
||||||
crt_rrmode.hSkew = 0;
|
crt_rrmode.hSkew = 0;
|
||||||
|
|
||||||
|
|
||||||
|
res = XRRGetScreenResources(dpy, window);
|
||||||
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
||||||
|
XRRModeInfo *swoldmode = NULL;
|
||||||
|
XRRModeInfo *swdeskmode = NULL;
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
||||||
|
|
||||||
for (m = 0; m < resources->nmode; m++)
|
for (int m = 0; m < resources->nmode; m++)
|
||||||
{
|
{
|
||||||
if (string_is_equal(resources->modes[m].name, dmode))
|
if (strcmp(resources->modes[m].name, dmode) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
crt_exists = true;
|
crt_exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -533,15 +529,20 @@ static void x11_display_server_destroy(void *data)
|
|||||||
|
|
||||||
XRRFreeScreenResources(resources);
|
XRRFreeScreenResources(resources);
|
||||||
|
|
||||||
if (!crt_exists)
|
|
||||||
XRRCreateMode(dpy, window, &crt_rrmode);
|
if (crt_exists == false)
|
||||||
|
{
|
||||||
|
RRMode wMode = XRRCreateMode(dpy, window, &crt_rrmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
resources = XRRGetScreenResourcesCurrent(dpy, window);
|
||||||
|
|
||||||
for (m = 0; m < resources->nmode; m++)
|
for (int m = 0; m < resources->nmode; m++)
|
||||||
{
|
{
|
||||||
if (string_is_equal(resources->modes[m].name, dmode))
|
if (strcmp(resources->modes[m].name, dmode) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
swdeskmode = &resources->modes[m];
|
swdeskmode = &resources->modes[m];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -551,53 +552,45 @@ static void x11_display_server_destroy(void *data)
|
|||||||
{
|
{
|
||||||
if (g_monitor_index == 20)
|
if (g_monitor_index == 20)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < res->noutput; i++)
|
||||||
for (i = 0; i < res->noutput; i++)
|
|
||||||
{
|
{
|
||||||
XRROutputInfo *outputs = XRRGetOutputInfo(
|
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[i]);
|
||||||
dpy, res, res->outputs[i]);
|
|
||||||
|
|
||||||
if (outputs->connection == RR_Connected)
|
if (outputs->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
XRRCrtcInfo *crtc;
|
|
||||||
|
|
||||||
XRRAddOutputMode(dpy, res->outputs[i], swdeskmode->id);
|
XRRAddOutputMode(dpy, res->outputs[i], swdeskmode->id);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
strlcpy(orig_output, outputs->name, sizeof(orig_output));
|
snprintf(orig_output, sizeof(orig_output), "%s", outputs->name);
|
||||||
crtc = XRRGetCrtcInfo(dpy, resources,
|
XRRCrtcInfo *crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
||||||
outputs->crtc);
|
|
||||||
crtc->mode = swdeskmode->id;
|
crtc->mode = swdeskmode->id;
|
||||||
crtc->width = swdeskmode->width;
|
crtc->width = swdeskmode->width;
|
||||||
crtc->height = swdeskmode->height;
|
crtc->height = swdeskmode->height;
|
||||||
XRRSetCrtcConfig(dpy, res,res->crtcs[i], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
XRRSetCrtcConfig(dpy, res,res->crtcs[i], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XRRSetScreenSize(dpy, window,
|
XRRSetScreenSize(dpy, window, crt_rrmode.width, crt_rrmode.height, (int) ((25.4 * crt_rrmode.width) / 96.0), (int) ((25.4 * crt_rrmode.height) / 96.0));
|
||||||
crt_rrmode.width,
|
XRRSetCrtcConfig(dpy, res, res->crtcs[i], CurrentTime, crtc->x, crtc->y, crtc->mode, crtc->rotation, crtc->outputs, crtc->noutput);
|
||||||
crt_rrmode.height,
|
|
||||||
(int) ((25.4 * crt_rrmode.width) / 96.0),
|
|
||||||
(int) ((25.4 * crt_rrmode.height) / 96.0));
|
|
||||||
XRRSetCrtcConfig(dpy, res, res->crtcs[i], CurrentTime,
|
|
||||||
crtc->x, crtc->y, crtc->mode,
|
|
||||||
crtc->rotation, crtc->outputs, crtc->noutput);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
XRRFreeOutputInfo(outputs);
|
XRRFreeOutputInfo(outputs);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XRRFreeScreenResources(resources);
|
XRRFreeScreenResources(resources);
|
||||||
}
|
}
|
||||||
else if (g_monitor_index != 20)
|
else if (g_monitor_index != 20)
|
||||||
{
|
{
|
||||||
|
|
||||||
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[g_monitor_index]);
|
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[g_monitor_index]);
|
||||||
|
|
||||||
if (outputs->connection == RR_Connected)
|
if (outputs->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
XRRCrtcInfo *crtc;
|
|
||||||
XRRAddOutputMode(dpy, res->outputs[g_monitor_index], swdeskmode->id);
|
XRRAddOutputMode(dpy, res->outputs[g_monitor_index], swdeskmode->id);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
strlcpy(orig_output, outputs->name, sizeof(orig_output));
|
snprintf(orig_output, sizeof(orig_output), "%s", outputs->name);
|
||||||
crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
XRRCrtcInfo *crtc = XRRGetCrtcInfo(dpy, resources, outputs->crtc);
|
||||||
crtc->mode = swdeskmode->id;
|
crtc->mode = swdeskmode->id;
|
||||||
crtc->width = swdeskmode->width;
|
crtc->width = swdeskmode->width;
|
||||||
crtc->height = swdeskmode->height;
|
crtc->height = swdeskmode->height;
|
||||||
@ -610,21 +603,20 @@ static void x11_display_server_destroy(void *data)
|
|||||||
XRRFreeCrtcInfo(crtc);
|
XRRFreeCrtcInfo(crtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (m = 0; m < resources->nmode; m++)
|
for (int m = 0; m < resources->nmode; m++)
|
||||||
{
|
{
|
||||||
int j, i;
|
for (int j = 0; j < res->noutput; j++)
|
||||||
|
|
||||||
for (j = 0; j < res->noutput; j++)
|
|
||||||
{
|
{
|
||||||
for (i = 1 ; i <= crt_name_id; i++ )
|
for (int i = 1 ; i <= crt_name_id; i++ )
|
||||||
{
|
{
|
||||||
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[j]);
|
XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[j]);
|
||||||
if (outputs->connection == RR_Connected)
|
if (outputs->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
snprintf(old_mode, sizeof(old_mode), "CRT%d", i);
|
snprintf(old_mode, sizeof(old_mode), "CRT%d", i);
|
||||||
if (string_is_equal(resources->modes[m].name, old_mode))
|
if (strcmp(resources->modes[m].name, old_mode) == 0)
|
||||||
{
|
{
|
||||||
swoldmode = &resources->modes[m];
|
swoldmode = &resources->modes[m];
|
||||||
XRRDeleteOutputMode(dpy, res->outputs[j], swoldmode->id);
|
XRRDeleteOutputMode(dpy, res->outputs[j], swoldmode->id);
|
||||||
@ -635,6 +627,8 @@ static void x11_display_server_destroy(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dispserv)
|
if (dispserv)
|
||||||
@ -644,8 +638,7 @@ static void x11_display_server_destroy(void *data)
|
|||||||
static bool x11_display_server_set_window_opacity(void *data, unsigned opacity)
|
static bool x11_display_server_set_window_opacity(void *data, unsigned opacity)
|
||||||
{
|
{
|
||||||
dispserv_x11_t *serv = (dispserv_x11_t*)data;
|
dispserv_x11_t *serv = (dispserv_x11_t*)data;
|
||||||
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY",
|
Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False);
|
||||||
False);
|
|
||||||
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
||||||
|
|
||||||
serv->opacity = opacity;
|
serv->opacity = opacity;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user