Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7bb12b9e
Commit
7bb12b9e
authored
Nov 01, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 01, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Add support for saving/reading display settings.
parent
2712eb50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
2 deletions
+71
-2
settings.c
dlls/winex11.drv/settings.c
+71
-2
No files found.
dlls/winex11.drv/settings.c
View file @
7bb12b9e
...
...
@@ -24,6 +24,7 @@
#include "x11drv.h"
#include "windef.h"
#include "winreg.h"
#include "wingdi.h"
#include "ddrawi.h"
#include "wine/debug.h"
...
...
@@ -144,11 +145,13 @@ static int X11DRV_nores_GetCurrentMode(void)
{
return
0
;
}
static
LONG
X11DRV_nores_SetCurrentMode
(
int
mode
)
{
TRACE
(
"Ignoring mode change request
\n
"
);
return
DISP_CHANGE_FAILED
;
}
/* default handler only gets the current X desktop resolution */
void
X11DRV_Settings_Init
(
void
)
{
...
...
@@ -159,6 +162,68 @@ void X11DRV_Settings_Init(void)
X11DRV_Settings_AddOneMode
(
screen_width
,
screen_height
,
0
,
60
);
}
/* Our fake driver GUID path */
static
const
char
wine_X11_reg_key
[]
=
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
{64498428-1122-3344-5566-778899aabbcc}
\\
0000"
;
static
BOOL
read_registry_settings
(
DEVMODEW
*
dm
)
{
HKEY
hkey
;
DWORD
type
,
size
;
BOOL
ret
=
TRUE
;
if
(
RegOpenKeyA
(
HKEY_CURRENT_CONFIG
,
wine_X11_reg_key
,
&
hkey
))
return
FALSE
;
#define query_value(name, data) \
if (RegQueryValueExA(hkey, name, 0, &type, (LPBYTE)(data), &size) || \
type != REG_DWORD || size != sizeof(DWORD)) \
ret = FALSE
query_value
(
"DefaultSettings.BitsPerPel"
,
&
dm
->
dmBitsPerPel
);
query_value
(
"DefaultSettings.XResolution"
,
&
dm
->
dmPelsWidth
);
query_value
(
"DefaultSettings.YResolution"
,
&
dm
->
dmPelsHeight
);
query_value
(
"DefaultSettings.VRefresh"
,
&
dm
->
dmDisplayFrequency
);
query_value
(
"DefaultSettings.Flags"
,
&
dm
->
dmDisplayFlags
);
query_value
(
"DefaultSettings.XPanning"
,
&
dm
->
dmPosition
.
x
);
query_value
(
"DefaultSettings.YPanning"
,
&
dm
->
dmPosition
.
y
);
query_value
(
"DefaultSettings.Orientation"
,
&
dm
->
dmDisplayOrientation
);
query_value
(
"DefaultSettings.FixedOutput"
,
&
dm
->
dmDisplayFixedOutput
);
#undef query_value
RegCloseKey
(
hkey
);
return
ret
;
}
static
BOOL
write_registry_settings
(
const
DEVMODEW
*
dm
)
{
HKEY
hkey
;
BOOL
ret
=
TRUE
;
if
(
RegCreateKeyA
(
HKEY_CURRENT_CONFIG
,
wine_X11_reg_key
,
&
hkey
))
return
FALSE
;
#define set_value(name, data) \
if (RegSetValueExA(hkey, name, 0, REG_DWORD, (LPBYTE)(data), sizeof(DWORD))) \
ret = FALSE
set_value
(
"DefaultSettings.BitsPerPel"
,
&
dm
->
dmBitsPerPel
);
set_value
(
"DefaultSettings.XResolution"
,
&
dm
->
dmPelsWidth
);
set_value
(
"DefaultSettings.YResolution"
,
&
dm
->
dmPelsHeight
);
set_value
(
"DefaultSettings.VRefresh"
,
&
dm
->
dmDisplayFrequency
);
set_value
(
"DefaultSettings.Flags"
,
&
dm
->
dmDisplayFlags
);
set_value
(
"DefaultSettings.XPanning"
,
&
dm
->
dmPosition
.
x
);
set_value
(
"DefaultSettings.YPanning"
,
&
dm
->
dmPosition
.
y
);
set_value
(
"DefaultSettings.Orientation"
,
&
dm
->
dmDisplayOrientation
);
set_value
(
"DefaultSettings.FixedOutput"
,
&
dm
->
dmDisplayFixedOutput
);
#undef set_value
RegCloseKey
(
hkey
);
return
ret
;
}
/***********************************************************************
* EnumDisplaySettingsEx (X11DRV.@)
*
...
...
@@ -192,7 +257,7 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW
if
(
n
==
ENUM_REGISTRY_SETTINGS
)
{
TRACE
(
"mode %d (registry) -- getting default mode (%s)
\n
"
,
n
,
handler_name
);
n
=
dd_mode_default
;
return
read_registry_settings
(
devmode
)
;
}
if
(
n
<
dd_mode_count
)
{
...
...
@@ -311,7 +376,11 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
}
/* we have a valid mode */
TRACE
(
"Requested display settings match mode %d (%s)
\n
"
,
i
,
handler_name
);
if
(
!
(
flags
&
CDS_TEST
))
if
(
flags
&
CDS_UPDATEREGISTRY
)
write_registry_settings
(
devmode
);
if
(
!
(
flags
&
(
CDS_TEST
|
CDS_NORESET
)))
return
pSetCurrentMode
(
i
);
return
DISP_CHANGE_SUCCESSFUL
;
}
...
...
Write
Preview
Markdown
is supported
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