Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Switch
RetroArch
RetroArch
Commits
2945d450
Commit
2945d450
authored
Nov 24, 2018
by
twinaphex
Browse files
Cleanups
parent
3d4fc5d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
gfx/display_servers/dispserv_x11.c
View file @
2945d450
...
...
@@ -92,7 +92,8 @@ static bool x11_display_server_set_window_opacity(void *data, unsigned opacity)
if
(
opacity
==
(
unsigned
)
-
1
)
XDeleteProperty
(
g_x11_dpy
,
g_x11_win
,
net_wm_opacity
);
else
XChangeProperty
(
g_x11_dpy
,
g_x11_win
,
net_wm_opacity
,
cardinal
,
32
,
PropModeReplace
,
(
const
unsigned
char
*
)
&
opacity
,
1
);
XChangeProperty
(
g_x11_dpy
,
g_x11_win
,
net_wm_opacity
,
cardinal
,
32
,
PropModeReplace
,
(
const
unsigned
char
*
)
&
opacity
,
1
);
return
true
;
}
...
...
@@ -101,9 +102,11 @@ static bool x11_display_server_set_window_decorations(void *data, bool on)
{
dispserv_x11_t
*
serv
=
(
dispserv_x11_t
*
)
data
;
serv
->
decorations
=
on
;
if
(
serv
)
serv
->
decorations
=
on
;
/* menu_setting performs a reinit instead to properly apply decoration changes */
/* menu_setting performs a reinit instead to properly apply
* decoration changes */
return
true
;
}
...
...
@@ -131,7 +134,7 @@ static bool x11_display_server_set_resolution(void *data,
/* set core refresh from hz */
video_monitor_set_refresh_rate
(
hz
);
/* following code is the mode line gen
o
rator */
/* following code is the mode line gen
e
rator */
hsp
=
width
*
1
.
140
;
hfp
=
width
*
1
.
055
;
...
...
@@ -144,9 +147,7 @@ static bool x11_display_server_set_resolution(void *data,
roundw
=
roundf
((
float
)
pwidth
/
(
float
)
height
*
100
)
/
100
;
if
(
height
>
width
)
{
roundw
=
roundf
((
float
)
height
/
(
float
)
width
*
100
)
/
100
;
}
if
(
roundw
>
1
.
35
)
roundw
=
1
.
25
;
...
...
@@ -158,111 +159,88 @@ static bool x11_display_server_set_resolution(void *data,
hmax
=
hbp
;
if
(
height
<
241
)
{
vmax
=
261
;
}
if
(
height
<
241
&&
hz
>
56
&&
hz
<
58
)
{
vmax
=
280
;
}
if
(
height
<
241
&&
hz
<
55
)
{
vmax
=
313
;
}
if
(
height
>
250
&&
height
<
260
&&
hz
>
54
)
{
vmax
=
296
;
}
if
(
height
>
250
&&
height
<
260
&&
hz
>
52
&&
hz
<
54
)
{
vmax
=
285
;
}
if
(
height
>
250
&&
height
<
260
&&
hz
<
52
)
{
vmax
=
313
;
}
if
(
height
>
260
&&
height
<
300
)
{
vmax
=
318
;
}
if
(
height
>
400
&&
hz
>
56
)
{
vmax
=
533
;
}
if
(
height
>
520
&&
hz
<
57
)
{
vmax
=
580
;
}
if
(
height
>
300
&&
hz
<
56
)
{
vmax
=
615
;
}
if
(
height
>
500
&&
hz
<
56
)
{
vmax
=
624
;
}
if
(
height
>
300
)
{
pdefault
=
pdefault
*
2
;
}
vfp
=
height
+
((
vmax
-
height
)
/
2
)
-
pdefault
;
if
(
height
<
300
)
{
vsp
=
vfp
+
3
;
/* needs to me 3 for progressive */
}
vsp
=
vfp
+
3
;
/* needs to be 3 for progressive */
if
(
height
>
300
)
{
vsp
=
vfp
+
6
;
/* needs to me 6 for interlaced */
}
vsp
=
vfp
+
6
;
/* needs to be 6 for interlaced */
vbp
=
vmax
;
if
(
height
<
300
)
{
pixel_clock
=
(
hmax
*
vmax
*
hz
)
/
1000000
;
}
if
(
height
>
300
)
{
pixel_clock
=
((
hmax
*
vmax
*
hz
)
/
1000000
)
/
2
;
}
/* above code is the modeline genorator */
/* above code is the modeline generator */
/* create interlaced newmode from modline variables */
if
(
height
<
300
)
{
snprintf
(
xrandr
,
sizeof
(
xrandr
),
"xrandr --newmode
\"
%dx%d_%0.2f
\"
%lf %d %d %d %d %d %d %d %d -hsync -vsync"
,
width
,
height
,
hz
,
pixel_clock
,
width
,
hfp
,
hsp
,
hbp
,
height
,
vfp
,
vsp
,
vbp
);
snprintf
(
xrandr
,
sizeof
(
xrandr
),
"xrandr --newmode
\"
%dx%d_%0.2f
\"
%lf %d %d %d %d %d %d %d %d -hsync -vsync"
,
width
,
height
,
hz
,
pixel_clock
,
width
,
hfp
,
hsp
,
hbp
,
height
,
vfp
,
vsp
,
vbp
);
system
(
xrandr
);
}
/* create interlaced newmode from modline variables */
if
(
height
>
300
)
{
snprintf
(
xrandr
,
sizeof
(
xrandr
),
"xrandr --newmode
\"
%dx%d_%0.2f
\"
%lf %d %d %d %d %d %d %d %d interlace -hsync -vsync"
,
width
,
height
,
hz
,
pixel_clock
,
width
,
hfp
,
hsp
,
hbp
,
height
,
vfp
,
vsp
,
vbp
);
snprintf
(
xrandr
,
sizeof
(
xrandr
),
"xrandr --newmode
\"
%dx%d_%0.2f
\"
%lf %d %d %d %d %d %d %d %d interlace -hsync -vsync"
,
width
,
height
,
hz
,
pixel_clock
,
width
,
hfp
,
hsp
,
hbp
,
height
,
vfp
,
vsp
,
vbp
);
system
(
xrandr
);
}
/* variable for new mode */
snprintf
(
new_mode
,
sizeof
(
new_mode
),
"%dx%d_%0.2f"
,
width
,
height
,
hz
);
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to add and delete modes */
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
* add and delete modes */
for
(
i
=
0
;
i
<
3
;
i
++
)
{
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s%d %s"
,
"DVI"
,
i
,
new_mode
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s%d %s"
,
"DVI"
,
i
,
new_mode
);
system
(
output
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --delmode %s%d %s"
,
"DVI"
,
i
,
old_mode
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --delmode %s%d %s"
,
"DVI"
,
i
,
old_mode
);
system
(
output
);
}
for
(
i
=
0
;
i
<
3
;
i
++
)
{
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s-%d %s"
,
"DVI"
,
i
,
new_mode
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s-%d %s"
,
"DVI"
,
i
,
new_mode
);
system
(
output
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --delmode %s-%d %s"
,
"DVI"
,
i
,
old_mode
);
snprintf
(
output
,
sizeof
(
output
),
"xrandr --delmode %s-%d %s"
,
"DVI"
,
i
,
old_mode
);
system
(
output
);
}
for
(
i
=
0
;
i
<
3
;
i
++
)
{
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s%d %s"
,
"VGA"
,
i
,
new_mode
);
...
...
@@ -270,6 +248,7 @@ static bool x11_display_server_set_resolution(void *data,
snprintf
(
output
,
sizeof
(
output
),
"xrandr --delmode %s%d %s"
,
"VGA"
,
i
,
old_mode
);
system
(
output
);
}
for
(
i
=
0
;
i
<
3
;
i
++
)
{
snprintf
(
output
,
sizeof
(
output
),
"xrandr --addmode %s-%d %s"
,
"VGA"
,
i
,
new_mode
);
...
...
@@ -285,12 +264,14 @@ static bool x11_display_server_set_resolution(void *data,
snprintf
(
output
,
sizeof
(
output
),
"xrandr --rmmode %s"
,
old_mode
);
system
(
output
);
system
(
"xdotool windowactivate $(xdotool search --class RetroArch)"
);
/* needs xdotool installed. needed to recapture window. */
/* needs xdotool installed. needed to recapture window. */
system
(
"xdotool windowactivate $(xdotool search --class RetroArch)"
);
/* variable for old mode */
snprintf
(
old_mode
,
sizeof
(
old_mode
),
"%s"
,
new_mode
);
system
(
"xdotool windowactivate $(xdotool search --class RetroArch)"
);
/* needs xdotool installed. needed to recapture window. */
/* needs xdotool installed. needed to recapture window. */
system
(
"xdotool windowactivate $(xdotool search --class RetroArch)"
);
/* Second run needed as some times it runs to fast to capture first time */
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment