-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchimeraos.patch
2028 lines (1856 loc) · 72.2 KB
/
chimeraos.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From c06cdd847679c930ee6197514970bc21f523e853 Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Fri, 17 May 2024 19:43:49 -0500
Subject: [PATCH 01/22] Add touch-gestures to open up Steam menus
---
src/main.cpp | 5 +++++
src/wlserver.cpp | 28 ++++++++++++++++++++++++++++
src/wlserver.hpp | 1 +
3 files changed, 34 insertions(+)
diff --git a/src/main.cpp b/src/main.cpp
index cd4aeca..4b91c97 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -108,6 +108,8 @@ const struct option *gamescope_options = (struct option[]){
// wlserver options
{ "xwayland-count", required_argument, nullptr, 0 },
+ { "touch-gestures", no_argument, nullptr, 0 },
+
// steamcompmgr options
{ "cursor", required_argument, nullptr, 0 },
@@ -185,6 +187,7 @@ const char usage[] =
" -T, --stats-path write statistics to path\n"
" -C, --hide-cursor-delay hide cursor image after delay\n"
" -e, --steam enable Steam integration\n"
+ " --touch-gestures enable touch gestures for Steam menus\n"
" --xwayland-count create N xwayland servers\n"
" --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n"
" --force-orientation rotate the internal display (left, right, normal, upsidedown)\n"
@@ -734,6 +737,8 @@ int main(int argc, char **argv)
g_bDebugLayers = true;
} else if (strcmp(opt_name, "disable-color-management") == 0) {
g_bForceDisableColorMgmt = true;
+ } else if (strcmp(opt_name, "touch-gestures") == 0) {
+ cv_touch_gestures = true;
} else if (strcmp(opt_name, "xwayland-count") == 0) {
g_nXWaylandCount = atoi( optarg );
} else if (strcmp(opt_name, "composite-debug") == 0) {
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index ee6891d..62da656 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -73,6 +73,7 @@
static LogScope wl_log("wlserver");
//#define GAMESCOPE_SWAPCHAIN_DEBUG
+gamescope::ConVar<bool> cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" );
struct wlserver_t wlserver = {
.touch_down_ids = {}
@@ -2568,6 +2569,33 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool
if ( bAlwaysWarpCursor )
wlserver_mousewarp( tx, ty, time, false );
+
+ if (cv_touch_gestures) {
+ bool start_gesture = false;
+
+ // Round the x-coordinate to the nearest whole number
+ uint32_t roundedCursorX = static_cast<int>(std::round(tx));
+ // Grab 2% of the display to be used for the edge range
+ uint32_t edge_range = static_cast<uint32_t>(g_nOutputWidth * 0.02);
+
+ // Determine if the gesture should start
+ if (roundedCursorX <= edge_range || roundedCursorX >= g_nOutputWidth - edge_range) {
+ start_gesture = true;
+ }
+
+ // Handle Home gesture
+ if (start_gesture && roundedCursorX >= edge_range) {
+ wlserver_open_steam_menu(0);
+ start_gesture = false;
+ }
+
+ // Handle QAM gesture
+ if (start_gesture && roundedCursorX >= g_nOutputWidth - edge_range && roundedCursorX <= g_nOutputWidth) {
+ wlserver_open_steam_menu(1);
+ start_gesture = false;
+ }
+ }
+
}
else if ( eMode == gamescope::TouchClickModes::Disabled )
{
diff --git a/src/wlserver.hpp b/src/wlserver.hpp
index db7d491..da67bf7 100644
--- a/src/wlserver.hpp
+++ b/src/wlserver.hpp
@@ -291,6 +291,7 @@ void wlserver_x11_surface_info_finish( struct wlserver_x11_surface_info *surf );
void wlserver_set_xwayland_server_mode( size_t idx, int w, int h, int refresh );
extern std::atomic<bool> g_bPendingTouchMovement;
+extern gamescope::ConVar<bool> cv_touch_gestures;
void wlserver_open_steam_menu( bool qam );
--
2.45.2
From 34f22c6a52dbed8662132e4bdfd8a29dd1b7825c Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Fri, 17 May 2024 20:16:20 -0500
Subject: [PATCH 02/22] Add bypass_steam_resolution to workaround the 720p/800p
restrictions Steam has for games
---
src/main.cpp | 3 +++
src/steamcompmgr.cpp | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/main.cpp b/src/main.cpp
index 4b91c97..3d1057a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -129,6 +129,8 @@ const struct option *gamescope_options = (struct option[]){
{ "fade-out-duration", required_argument, nullptr, 0 },
{ "force-orientation", required_argument, nullptr, 0 },
{ "force-windows-fullscreen", no_argument, nullptr, 0 },
+ { "bypass-steam-resolution", no_argument, nullptr, 0 },
+
{ "disable-color-management", no_argument, nullptr, 0 },
{ "sdr-gamut-wideness", required_argument, nullptr, 0 },
@@ -187,6 +189,7 @@ const char usage[] =
" -T, --stats-path write statistics to path\n"
" -C, --hide-cursor-delay hide cursor image after delay\n"
" -e, --steam enable Steam integration\n"
+ " --bypass-steam-resolution bypass Steam's default 720p/800p default resolution\n"
" --touch-gestures enable touch gestures for Steam menus\n"
" --xwayland-count create N xwayland servers\n"
" --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n"
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 9ee265d..bec4268 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -349,6 +349,8 @@ bool g_bForceHDR10OutputDebug = false;
gamescope::ConVar<bool> cv_hdr_enabled{ "hdr_enabled", false, "Whether or not HDR is enabled if it is available." };
bool g_bHDRItmEnable = false;
int g_nCurrentRefreshRate_CachedValue = 0;
+gamescope::ConVar<bool> cv_bypass_steam_resolution{ "bypass_steam_resolution", false, "Workaround the 720p/800p limits Steam uses for games" };
+
static void
update_color_mgmt()
@@ -5320,6 +5322,13 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
size_t server_idx = size_t{ xwayland_mode_ctl[ 0 ] };
int width = xwayland_mode_ctl[ 1 ];
int height = xwayland_mode_ctl[ 2 ];
+
+ if ( g_nOutputWidth != 1280 && width == 1280 && cv_bypass_steam_resolution )
+ {
+ width = g_nOutputWidth;
+ height = g_nOutputHeight;
+ }
+
bool allowSuperRes = !!xwayland_mode_ctl[ 3 ];
if ( !allowSuperRes )
@@ -7166,6 +7175,8 @@ steamcompmgr_main(int argc, char **argv)
bForceWindowsFullscreen = true;
} else if (strcmp(opt_name, "hdr-enabled") == 0) {
cv_hdr_enabled = true;
+ } else if (strcmp(opt_name, "bypass_steam_resolution") == 0) {
+ cv_bypass_steam_resolution = true;
} else if (strcmp(opt_name, "hdr-debug-force-support") == 0) {
g_bForceHDRSupportDebug = true;
} else if (strcmp(opt_name, "hdr-debug-force-output") == 0) {
--
2.45.2
From 4c5657cca9a37fee0eee1d86ef3c2a6e5acef09c Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Wed, 26 Jul 2023 20:46:29 -0500
Subject: [PATCH 03/22] Add force external orientation.
Co-authored-by: Bouke Sybren Haarsma <[email protected]>
---
src/Backends/DRMBackend.cpp | 5 +++++
src/main.cpp | 25 ++++++++++++++++++++++++-
src/main.hpp | 1 +
src/wlserver.cpp | 23 +++++++++++++++++++++++
4 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp
index 92f01ca..4c72dc1 100644
--- a/src/Backends/DRMBackend.cpp
+++ b/src/Backends/DRMBackend.cpp
@@ -536,6 +536,7 @@ bool g_bSupportsSyncObjs = false;
extern gamescope::GamescopeModeGeneration g_eGamescopeModeGeneration;
extern GamescopePanelOrientation g_DesiredInternalOrientation;
+extern GamescopePanelOrientation g_DesiredExternalOrientation;
extern bool g_bForceDisableColorMgmt;
@@ -2023,6 +2024,10 @@ namespace gamescope
{
m_ChosenOrientation = g_DesiredInternalOrientation;
}
+ else if ( this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_EXTERNAL && g_DesiredExternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO )
+ {
+ m_ChosenOrientation = g_DesiredExternalOrientation;
+ }
else
{
if ( this->GetProperties().panel_orientation )
diff --git a/src/main.cpp b/src/main.cpp
index 3d1057a..fac3df2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -128,6 +128,7 @@ const struct option *gamescope_options = (struct option[]){
{ "disable-xres", no_argument, nullptr, 'x' },
{ "fade-out-duration", required_argument, nullptr, 0 },
{ "force-orientation", required_argument, nullptr, 0 },
+ { "force-external-orientation", required_argument, nullptr, 0 },
{ "force-windows-fullscreen", no_argument, nullptr, 0 },
{ "bypass-steam-resolution", no_argument, nullptr, 0 },
@@ -194,6 +195,7 @@ const char usage[] =
" --xwayland-count create N xwayland servers\n"
" --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n"
" --force-orientation rotate the internal display (left, right, normal, upsidedown)\n"
+ " --force-external-orientation rotate the external display (left, right, normal, upsidedown)\n"
" --force-windows-fullscreen force windows inside of gamescope to be the size of the nested display (fullscreen)\n"
" --cursor-scale-height if specified, sets a base output height to linearly scale the cursor against.\n"
" --hdr-enabled enable HDR output (needs Gamescope WSI layer enabled for support from clients)\n"
@@ -289,6 +291,8 @@ bool g_bOutputHDREnabled = false;
bool g_bFullscreen = false;
bool g_bForceRelativeMouse = false;
+bool g_bExternalForced = false;
+
bool g_bGrabbed = false;
float g_mouseSensitivity = 1.0;
@@ -362,7 +366,24 @@ static GamescopePanelOrientation force_orientation(const char *str)
} else if (strcmp(str, "upsidedown") == 0) {
return GAMESCOPE_PANEL_ORIENTATION_180;
} else {
- fprintf( stderr, "gamescope: invalid value for --force-orientation\n" );
+ fprintf( stderr, "gamescope: invalid value for given for --force-orientation\n" );
+ exit(1);
+ }
+}
+
+GamescopePanelOrientation g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_AUTO;
+static GamescopePanelOrientation force_external_orientation(const char *str)
+{
+ if (strcmp(str, "normal") == 0) {
+ return GAMESCOPE_PANEL_ORIENTATION_0;
+ } else if (strcmp(str, "right") == 0) {
+ return GAMESCOPE_PANEL_ORIENTATION_270;
+ } else if (strcmp(str, "left") == 0) {
+ return GAMESCOPE_PANEL_ORIENTATION_90;
+ } else if (strcmp(str, "upsidedown") == 0) {
+ return GAMESCOPE_PANEL_ORIENTATION_180;
+ } else {
+ fprintf( stderr, "gamescope: invalid value for --force-external-orientation\n" );
exit(1);
}
}
@@ -755,6 +776,8 @@ int main(int argc, char **argv)
g_eGamescopeModeGeneration = parse_gamescope_mode_generation( optarg );
} else if (strcmp(opt_name, "force-orientation") == 0) {
g_DesiredInternalOrientation = force_orientation( optarg );
+ } else if (strcmp(opt_name, "force-external-orientation") == 0) {
+ g_DesiredExternalOrientation = force_external_orientation( optarg );
} else if (strcmp(opt_name, "sharpness") == 0 ||
strcmp(opt_name, "fsr-sharpness") == 0) {
g_upscaleFilterSharpness = atoi( optarg );
diff --git a/src/main.hpp b/src/main.hpp
index 8cfe629..5492cae 100644
--- a/src/main.hpp
+++ b/src/main.hpp
@@ -28,6 +28,7 @@ extern bool g_bGrabbed;
extern float g_mouseSensitivity;
extern const char *g_sOutputName;
+extern bool g_bExternalForced;
enum class GamescopeUpscaleFilter : uint32_t
{
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 62da656..2998aed 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2530,6 +2530,29 @@ static void apply_touchscreen_orientation(double *x, double *y )
break;
}
+ // Rotate screen if it's forced with --force-external-orientation
+ switch ( GetBackend()->GetConnector( gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL )->GetCurrentOrientation() )
+ {
+ default:
+ case GAMESCOPE_PANEL_ORIENTATION_AUTO:
+ case GAMESCOPE_PANEL_ORIENTATION_0:
+ tx = *x;
+ ty = *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_90:
+ tx = 1.0 - *y;
+ ty = *x;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_180:
+ tx = 1.0 - *x;
+ ty = 1.0 - *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_270:
+ tx = *y;
+ ty = 1.0 - *x;
+ break;
+ }
+
*x = tx;
*y = ty;
}
--
2.45.2
From 897032bb4b8d8d5c11d67f9844a09a604b2c4333 Mon Sep 17 00:00:00 2001
From: Bouke Sybren Haarsma <[email protected]>
Date: Tue, 12 Mar 2024 00:07:57 +0100
Subject: [PATCH 04/22] implement force-panel-type
---
src/backend.h | 3 +++
src/gamescope_shared.h | 1 +
src/main.cpp | 16 ++++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/src/backend.h b/src/backend.h
index 9c2db15..046eb10 100644
--- a/src/backend.h
+++ b/src/backend.h
@@ -17,6 +17,7 @@ struct wlr_buffer;
struct wlr_dmabuf_attributes;
struct FrameInfo_t;
+extern gamescope::GamescopeScreenType g_ForcedScreenType;
namespace gamescope
{
@@ -213,6 +214,8 @@ namespace gamescope
// Dumb helper we should remove to support multi display someday.
gamescope::GamescopeScreenType GetScreenType()
{
+ if (g_ForcedScreenType != GAMESCOPE_SCREEN_TYPE_AUTO)
+ return g_ForcedScreenType;
if ( GetCurrentConnector() )
return GetCurrentConnector()->GetScreenType();
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index f34174e..ed30d8c 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -22,6 +22,7 @@ namespace gamescope
{
GAMESCOPE_SCREEN_TYPE_INTERNAL,
GAMESCOPE_SCREEN_TYPE_EXTERNAL,
+ GAMESCOPE_SCREEN_TYPE_AUTO,
GAMESCOPE_SCREEN_TYPE_COUNT
};
diff --git a/src/main.cpp b/src/main.cpp
index fac3df2..8bea38c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -129,6 +129,7 @@ const struct option *gamescope_options = (struct option[]){
{ "fade-out-duration", required_argument, nullptr, 0 },
{ "force-orientation", required_argument, nullptr, 0 },
{ "force-external-orientation", required_argument, nullptr, 0 },
+ { "force-panel-type", required_argument, nullptr, 0 },
{ "force-windows-fullscreen", no_argument, nullptr, 0 },
{ "bypass-steam-resolution", no_argument, nullptr, 0 },
@@ -196,6 +197,7 @@ const char usage[] =
" --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n"
" --force-orientation rotate the internal display (left, right, normal, upsidedown)\n"
" --force-external-orientation rotate the external display (left, right, normal, upsidedown)\n"
+ " --force-panel-type force gamescope to treat the display as either internal or external\n"
" --force-windows-fullscreen force windows inside of gamescope to be the size of the nested display (fullscreen)\n"
" --cursor-scale-height if specified, sets a base output height to linearly scale the cursor against.\n"
" --hdr-enabled enable HDR output (needs Gamescope WSI layer enabled for support from clients)\n"
@@ -387,6 +389,18 @@ static GamescopePanelOrientation force_external_orientation(const char *str)
exit(1);
}
}
+gamescope::GamescopeScreenType g_ForcedScreenType = gamescope::GAMESCOPE_SCREEN_TYPE_AUTO;
+static gamescope::GamescopeScreenType force_panel_type(const char *str)
+{
+ if (strcmp(str, "internal") == 0) {
+ return gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL;
+ } else if (strcmp(str, "external") == 0) {
+ return gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL;
+ } else {
+ fprintf( stderr, "gamescope: invalid value for --force-panel-type\n" );
+ exit(1);
+ }
+}
static enum GamescopeUpscaleScaler parse_upscaler_scaler(const char *str)
{
@@ -778,6 +792,8 @@ int main(int argc, char **argv)
g_DesiredInternalOrientation = force_orientation( optarg );
} else if (strcmp(opt_name, "force-external-orientation") == 0) {
g_DesiredExternalOrientation = force_external_orientation( optarg );
+ } else if (strcmp(opt_name, "force-panel-type") == 0) {
+ g_ForcedScreenType = force_panel_type( optarg );
} else if (strcmp(opt_name, "sharpness") == 0 ||
strcmp(opt_name, "fsr-sharpness") == 0) {
g_upscaleFilterSharpness = atoi( optarg );
--
2.45.2
From 2178f85676ba25434e8c39adc3848e3f7355acec Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Fri, 17 May 2024 21:11:34 -0500
Subject: [PATCH 05/22] wlserver: Fix an issue that would cause gamescope to
crash when the touchscreen was used
---
src/wlserver.cpp | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 2998aed..62da656 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2530,29 +2530,6 @@ static void apply_touchscreen_orientation(double *x, double *y )
break;
}
- // Rotate screen if it's forced with --force-external-orientation
- switch ( GetBackend()->GetConnector( gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL )->GetCurrentOrientation() )
- {
- default:
- case GAMESCOPE_PANEL_ORIENTATION_AUTO:
- case GAMESCOPE_PANEL_ORIENTATION_0:
- tx = *x;
- ty = *y;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_90:
- tx = 1.0 - *y;
- ty = *x;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_180:
- tx = 1.0 - *x;
- ty = 1.0 - *y;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_270:
- tx = *y;
- ty = 1.0 - *x;
- break;
- }
-
*x = tx;
*y = ty;
}
--
2.45.2
From 261124a5a85ad80b0d7b15926f230bacbca21b22 Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Fri, 17 May 2024 21:56:55 -0500
Subject: [PATCH 06/22] Add --custom-refresh-rates
---
src/Backends/DRMBackend.cpp | 4 ++++
src/main.cpp | 30 ++++++++++++++++++++++++++++++
src/main.hpp | 2 ++
3 files changed, 36 insertions(+)
diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp
index 4c72dc1..e4caebb 100644
--- a/src/Backends/DRMBackend.cpp
+++ b/src/Backends/DRMBackend.cpp
@@ -2125,6 +2125,10 @@ namespace gamescope
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv );
+ if ( g_customRefreshRates.size() > 0 ) {
+ m_Mutable.ValidDynamicRefreshRates = std::span(g_customRefreshRates);
+ return;
+ }
if ( bSteamDeckDisplay )
{
static constexpr uint32_t kPIDGalileoSDC = 0x3003;
diff --git a/src/main.cpp b/src/main.cpp
index 8bea38c..a9e1969 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -132,6 +132,7 @@ const struct option *gamescope_options = (struct option[]){
{ "force-panel-type", required_argument, nullptr, 0 },
{ "force-windows-fullscreen", no_argument, nullptr, 0 },
{ "bypass-steam-resolution", no_argument, nullptr, 0 },
+ { "custom-refresh-rates", required_argument, nullptr, 0 },
{ "disable-color-management", no_argument, nullptr, 0 },
@@ -210,6 +211,7 @@ const char usage[] =
" --hdr-itm-target-nits set the target luminace of the inverse tone mapping process.\n"
" Default: 1000 nits, Max: 10000 nits\n"
" --framerate-limit Set a simple framerate limit. Used as a divisor of the refresh rate, rounds down eg 60 / 59 -> 60fps, 60 / 25 -> 30fps. Default: 0, disabled.\n"
+ " --custom-refresh-rates Set custom refresh rates for the output. eg: 60,90,110-120\n"
" --mangoapp Launch with the mangoapp (mangohud) performance overlay enabled. You should use this instead of using mangohud on the game or gamescope.\n"
"\n"
"Nested mode options:\n"
@@ -462,6 +464,32 @@ static enum gamescope::GamescopeBackend parse_backend_name(const char *str)
fprintf( stderr, "gamescope: invalid value for --backend\n" );
exit(1);
}
+
+std::vector<uint32_t> g_customRefreshRates;
+// eg: 60,60,90,110-120
+static std::vector<uint32_t> parse_custom_refresh_rates( const char *str )
+{
+ std::vector<uint32_t> rates;
+ char *token = strtok( strdup(str), ",");
+ while (token)
+ {
+ char *dash = strchr(token, '-');
+ if (dash)
+ {
+ uint32_t start = atoi(token);
+ uint32_t end = atoi(dash + 1);
+ for (uint32_t i = start; i <= end; i++)
+ {
+ rates.push_back(i);
+ }
+ }
+ else
+ {
+ rates.push_back(atoi(token));
+ }
+ token = strtok(nullptr, ",");
+ }
+ return rates;
}
struct sigaction handle_signal_action = {};
@@ -794,6 +822,8 @@ int main(int argc, char **argv)
g_DesiredExternalOrientation = force_external_orientation( optarg );
} else if (strcmp(opt_name, "force-panel-type") == 0) {
g_ForcedScreenType = force_panel_type( optarg );
+ } else if (strcmp(opt_name, "custom-refresh-rates") == 0) {
+ g_customRefreshRates = parse_custom_refresh_rates( optarg );
} else if (strcmp(opt_name, "sharpness") == 0 ||
strcmp(opt_name, "fsr-sharpness") == 0) {
g_upscaleFilterSharpness = atoi( optarg );
diff --git a/src/main.hpp b/src/main.hpp
index 5492cae..0207a51 100644
--- a/src/main.hpp
+++ b/src/main.hpp
@@ -3,6 +3,7 @@
#include <getopt.h>
#include <atomic>
+#include <vector>
extern const char *gamescope_optstring;
extern const struct option *gamescope_options;
@@ -29,6 +30,7 @@ extern bool g_bGrabbed;
extern float g_mouseSensitivity;
extern const char *g_sOutputName;
extern bool g_bExternalForced;
+extern std::vector<uint32_t> g_customRefreshRates;
enum class GamescopeUpscaleFilter : uint32_t
{
--
2.45.2
From db4804880ea0fdf810979aea3153e2f45dc97bfe Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Sat, 18 May 2024 08:44:38 -0500
Subject: [PATCH 07/22] Add rotation gamescope_control command
---
protocol/gamescope-control.xml | 18 ++++++++++++
src/Backends/DRMBackend.cpp | 23 +++++++++++++++-
src/gamescope_shared.h | 10 +++++++
src/main.cpp | 1 +
src/wlserver.cpp | 50 ++++++++++++++++++++++++++++++++++
5 files changed, 101 insertions(+), 1 deletion(-)
diff --git a/protocol/gamescope-control.xml b/protocol/gamescope-control.xml
index 012c48c..eab8a84 100644
--- a/protocol/gamescope-control.xml
+++ b/protocol/gamescope-control.xml
@@ -99,5 +99,23 @@
<arg name="path" type="string" summary="Path to written screenshot"></arg>
</event>
+
+ <enum name="display_rotation_flag" bitfield="true" since="2">
+ <entry name="normal" value="1"/>
+ <entry name="left" value="2"/>
+ <entry name="right" value="3"/>
+ <entry name="upsidedown" value="4"/>
+ </enum>
+
+ <enum name="display_target_type" since="2">
+ <entry name="internal" value="1"/>
+ <entry name="external" value="2"/>
+ </enum>
+
+ <request name="rotate_display" since="2">
+ <arg name="orientation" type="uint" enum="display_rotation_flag" summary="Set the orientation of the display output."/>
+ <arg name="target_type" type="uint" enum="display_target_type" summary="Internal (1) or External (2) target type."/>
+ </request>
+
</interface>
</protocol>
diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp
index e4caebb..70d5cdf 100644
--- a/src/Backends/DRMBackend.cpp
+++ b/src/Backends/DRMBackend.cpp
@@ -2020,7 +2020,9 @@ namespace gamescope
void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode )
{
- if ( this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL && g_DesiredInternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO )
+ if ( this->GetScreenType() == ( GAMESCOPE_SCREEN_TYPE_INTERNAL && g_DesiredInternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO )
+ || ( GAMESCOPE_SCREEN_TYPE_EXTERNAL && g_DesiredExternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO
+ && g_bExternalForced ) )
{
m_ChosenOrientation = g_DesiredInternalOrientation;
}
@@ -2935,6 +2937,25 @@ bool drm_update_color_mgmt(struct drm_t *drm)
return true;
}
+void drm_set_orientation( struct drm_t *drm, bool isRotated)
+{
+ int width = g_nOutputWidth;
+ int height = g_nOutputHeight;
+ g_bRotated = isRotated;
+ if ( g_bRotated ) {
+ int tmp = width;
+ width = height;
+ height = tmp;
+ }
+
+ if (!drm->pConnector || !drm->pConnector->GetModeConnector())
+ return;
+
+ drmModeConnector *connector = drm->pConnector->GetModeConnector();
+ const drmModeModeInfo *mode = find_mode(connector, width, height, 0);
+ update_drm_effective_orientations(drm, mode);
+}
+
static void drm_unset_mode( struct drm_t *drm )
{
drm->pending.mode_id = 0;
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index ed30d8c..d04a907 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -62,6 +62,16 @@ enum GamescopePanelOrientation
GAMESCOPE_PANEL_ORIENTATION_AUTO,
};
+enum GamescopePanelExternalOrientation
+{
+ GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_0, // normal
+ GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_270, // right
+ GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_90, // left
+ GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_180, // upside down
+
+ GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_AUTO,
+};
+
// Disable partial composition for now until we get
// composite priorities working in libliftoff + also
// use the proper libliftoff composite plane system.
diff --git a/src/main.cpp b/src/main.cpp
index a9e1969..4469ac1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -397,6 +397,7 @@ static gamescope::GamescopeScreenType force_panel_type(const char *str)
if (strcmp(str, "internal") == 0) {
return gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL;
} else if (strcmp(str, "external") == 0) {
+ g_bExternalForced = true;
return gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL;
} else {
fprintf( stderr, "gamescope: invalid value for --force-panel-type\n" );
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 62da656..96bb7fc 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -1101,6 +1101,55 @@ static void gamescope_control_take_screenshot( struct wl_client *client, struct
} );
}
+static void gamescope_control_rotate_display( struct wl_client *client, struct wl_resource *resource, uint32_t orientation, uint32_t target_type )
+{
+ bool isRotated = false;
+ if (target_type == GAMESCOPE_CONTROL_DISPLAY_TARGET_TYPE_INTERNAL )
+ {
+ switch (orientation) {
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_0;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_90;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_270;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_180;
+ break;
+ default:
+ wl_log.errorf("Invalid target orientation selected");
+ }
+ }
+ else if (target_type == GAMESCOPE_CONTROL_DISPLAY_TARGET_TYPE_EXTERNAL )
+ {
+ switch (orientation) {
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_0;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_90;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_270;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
+ //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_180;
+ break;
+ default:
+ wl_log.errorf("Invalid target orientation selected");
+ }
+ }
+ //drm_set_orientation(&g_DRM, isRotated);
+ //g_DRM.out_of_date = 2;
+}
+
static void gamescope_control_handle_destroy( struct wl_client *client, struct wl_resource *resource )
{
wl_resource_destroy( resource );
@@ -1110,6 +1159,7 @@ static const struct gamescope_control_interface gamescope_control_impl = {
.destroy = gamescope_control_handle_destroy,
.set_app_target_refresh_cycle = gamescope_control_set_app_target_refresh_cycle,
.take_screenshot = gamescope_control_take_screenshot,
+ .rotate_display = gamescope_control_rotate_display,
};
static uint32_t get_conn_display_info_flags()
--
2.45.2
From ef9f07b932c8be1d391b9688b1b31edbb73e86ce Mon Sep 17 00:00:00 2001
From: Matthew Anderson <[email protected]>
Date: Sat, 18 May 2024 11:54:50 -0500
Subject: [PATCH 08/22] Fix an issue that caused force-panel to not work
---
protocol/gamescope-control.xml | 1 -
src/Backends/DRMBackend.cpp | 3 +
src/gamescope_shared.h | 10 ---
src/wlserver.cpp | 145 ++++++++++++++++++++-------------
4 files changed, 90 insertions(+), 69 deletions(-)
diff --git a/protocol/gamescope-control.xml b/protocol/gamescope-control.xml
index eab8a84..7f5578b 100644
--- a/protocol/gamescope-control.xml
+++ b/protocol/gamescope-control.xml
@@ -99,7 +99,6 @@
<arg name="path" type="string" summary="Path to written screenshot"></arg>
</event>
-
<enum name="display_rotation_flag" bitfield="true" since="2">
<entry name="normal" value="1"/>
<entry name="left" value="2"/>
diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp
index 70d5cdf..7af994e 100644
--- a/src/Backends/DRMBackend.cpp
+++ b/src/Backends/DRMBackend.cpp
@@ -318,6 +318,9 @@ namespace gamescope
GamescopeScreenType GetScreenType() const override
{
+ if ( g_ForcedScreenType != GAMESCOPE_SCREEN_TYPE_AUTO )
+ return g_ForcedScreenType;
+
if ( m_pConnector->connector_type == DRM_MODE_CONNECTOR_eDP ||
m_pConnector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
m_pConnector->connector_type == DRM_MODE_CONNECTOR_DSI )
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index d04a907..ed30d8c 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -62,16 +62,6 @@ enum GamescopePanelOrientation
GAMESCOPE_PANEL_ORIENTATION_AUTO,
};
-enum GamescopePanelExternalOrientation
-{
- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_0, // normal
- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_270, // right
- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_90, // left
- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_180, // upside down
-
- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_AUTO,
-};
-
// Disable partial composition for now until we get
// composite priorities working in libliftoff + also
// use the proper libliftoff composite plane system.
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 96bb7fc..959f63b 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -74,6 +74,8 @@ static LogScope wl_log("wlserver");
//#define GAMESCOPE_SWAPCHAIN_DEBUG
gamescope::ConVar<bool> cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" );
+extern GamescopePanelOrientation g_DesiredInternalOrientation;
+extern GamescopePanelOrientation g_DesiredExternalOrientation;
struct wlserver_t wlserver = {
.touch_down_ids = {}
@@ -1107,43 +1109,43 @@ static void gamescope_control_rotate_display( struct wl_client *client, struct w
if (target_type == GAMESCOPE_CONTROL_DISPLAY_TARGET_TYPE_INTERNAL )
{
switch (orientation) {
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
- //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_0;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
- //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_90;
- isRotated = true;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
- //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_270;
- isRotated = true;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
- //m_ChosenOrientation = GAMESCOPE_PANEL_ORIENTATION_180;
- break;
- default:
- wl_log.errorf("Invalid target orientation selected");
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
+ g_DesiredInternalOrientation = GAMESCOPE_PANEL_ORIENTATION_0;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
+ g_DesiredInternalOrientation = GAMESCOPE_PANEL_ORIENTATION_90;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
+ g_DesiredInternalOrientation = GAMESCOPE_PANEL_ORIENTATION_270;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
+ g_DesiredInternalOrientation = GAMESCOPE_PANEL_ORIENTATION_180;
+ break;
+ default:
+ wl_log.errorf("Invalid target orientation selected");
}
}
else if (target_type == GAMESCOPE_CONTROL_DISPLAY_TARGET_TYPE_EXTERNAL )
{
switch (orientation) {
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
- //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_0;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
- //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_90;
- isRotated = true;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
- //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_270;
- isRotated = true;
- break;
- case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
- //m_ChosenOrientation = GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_180;
- break;
- default:
- wl_log.errorf("Invalid target orientation selected");
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_NORMAL:
+ g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_0;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_LEFT:
+ g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_90;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_RIGHT:
+ g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_270;
+ isRotated = true;
+ break;
+ case GAMESCOPE_CONTROL_DISPLAY_ROTATION_FLAG_UPSIDEDOWN:
+ g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_180;
+ break;
+ default:
+ wl_log.errorf("Invalid target orientation selected");
}
}
//drm_set_orientation(&g_DRM, isRotated);
@@ -2554,34 +2556,61 @@ const std::shared_ptr<wlserver_vk_swapchain_feedback>& wlserver_surface_swapchai
/* Handle the orientation of the touch inputs */
static void apply_touchscreen_orientation(double *x, double *y )
{
- double tx = 0;
- double ty = 0;
+ double tx = 0;
+ double ty = 0;
- // Use internal screen always for orientation purposes.
- switch ( GetBackend()->GetConnector( gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL )->GetCurrentOrientation() )
- {
- default:
- case GAMESCOPE_PANEL_ORIENTATION_AUTO:
- case GAMESCOPE_PANEL_ORIENTATION_0:
- tx = *x;
- ty = *y;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_90:
- tx = 1.0 - *y;
- ty = *x;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_180:
- tx = 1.0 - *x;
- ty = 1.0 - *y;
- break;
- case GAMESCOPE_PANEL_ORIENTATION_270:
- tx = *y;
- ty = 1.0 - *x;
- break;
- }
+ // Use internal screen always for orientation purposes.
+ if ( g_ForcedScreenType == gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL || g_ForcedScreenType == gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL )
+ {
+ switch ( g_DesiredInternalOrientation )
+ {
+ default:
+ case GAMESCOPE_PANEL_ORIENTATION_AUTO:
+ case GAMESCOPE_PANEL_ORIENTATION_0:
+ tx = *x;
+ ty = *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_90:
+ tx = 1.0 - *y;
+ ty = *x;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_180:
+ tx = 1.0 - *x;
+ ty = 1.0 - *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_270:
+ tx = *y;
+ ty = 1.0 - *x;
+ break;
+ }
+ }
+ else if (g_ForcedScreenType == gamescope::GAMESCOPE_SCREEN_TYPE_AUTO)
+ {
+ switch (GetBackend()->GetConnector(gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL)->GetCurrentOrientation())
+ {
+ default:
+ case GAMESCOPE_PANEL_ORIENTATION_AUTO:
+ case GAMESCOPE_PANEL_ORIENTATION_0:
+ tx = *x;
+ ty = *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_90:
+ tx = 1.0 - *y;
+ ty = *x;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_180:
+ tx = 1.0 - *x;
+ ty = 1.0 - *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_270:
+ tx = *y;
+ ty = 1.0 - *x;
+ break;
+ }
+ }
- *x = tx;
- *y = ty;
+ *x = tx;