Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f0bd1ee7
Commit
f0bd1ee7
authored
Apr 25, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecfg: Allow to configure the desktop separately for each application.
parent
ad587673
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
50 deletions
+59
-50
x11drvdlg.c
programs/winecfg/x11drvdlg.c
+59
-50
No files found.
programs/winecfg/x11drvdlg.c
View file @
f0bd1ee7
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdio.h>
#include <windows.h>
#include <windows.h>
#include <wine/unicode.h>
#include <wine/debug.h>
#include <wine/debug.h>
#include "resource.h"
#include "resource.h"
...
@@ -45,6 +46,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
...
@@ -45,6 +46,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
static
const
WCHAR
logpixels_reg
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'H'
,
'a'
,
'r'
,
'd'
,
'w'
,
'a'
,
'r'
,
'e'
,
' '
,
'P'
,
'r'
,
'o'
,
'f'
,
'i'
,
'l'
,
'e'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
logpixels_reg
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'H'
,
'a'
,
'r'
,
'd'
,
'w'
,
'a'
,
'r'
,
'e'
,
' '
,
'P'
,
'r'
,
'o'
,
'f'
,
'i'
,
'l'
,
'e'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
logpixels
[]
=
{
'L'
,
'o'
,
'g'
,
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
's'
,
0
};
static
const
WCHAR
logpixels
[]
=
{
'L'
,
'o'
,
'g'
,
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
's'
,
0
};
static
const
WCHAR
desktopW
[]
=
{
'D'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
0
};
static
const
WCHAR
defaultW
[]
=
{
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
0
};
static
const
WCHAR
explorerW
[]
=
{
'E'
,
'x'
,
'p'
,
'l'
,
'o'
,
'r'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
explorer_desktopsW
[]
=
{
'E'
,
'x'
,
'p'
,
'l'
,
'o'
,
'r'
,
'e'
,
'r'
,
'\\'
,
'D'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
's'
,
0
};
static
const
WCHAR
x11_driverW
[]
=
{
'X'
,
'1'
,
'1'
,
' '
,
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
default_resW
[]
=
{
'8'
,
'0'
,
'0'
,
'x'
,
'6'
,
'0'
,
'0'
,
0
};
static
struct
SHADERMODE
static
struct
SHADERMODE
{
{
UINT
displayStrID
;
UINT
displayStrID
;
...
@@ -58,64 +68,55 @@ static struct SHADERMODE
...
@@ -58,64 +68,55 @@ static struct SHADERMODE
int
updating_ui
;
int
updating_ui
;
static
void
update_gui_for_desktop_mode
(
HWND
dialog
)
{
/* convert the x11 desktop key to the new explorer config */
int
desktopenabled
=
FALSE
;
static
void
convert_x11_desktop_key
(
void
)
{
char
*
buf
;
if
(
!
(
buf
=
get_reg_key
(
config_key
,
"X11 Driver"
,
"Desktop"
,
NULL
)))
return
;
set_reg_key
(
config_key
,
"Explorer
\\
Desktops"
,
"Default"
,
buf
);
set_reg_key
(
config_key
,
"Explorer"
,
"Desktop"
,
"Default"
);
set_reg_key
(
config_key
,
"X11 Driver"
,
"Desktop"
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
static
void
update_gui_for_desktop_mode
(
HWND
dialog
)
{
WCHAR
*
buf
,
*
bufindex
;
const
WCHAR
*
desktop_name
=
current_app
?
current_app
:
defaultW
;
WINE_TRACE
(
"
\n
"
);
WINE_TRACE
(
"
\n
"
);
updating_ui
=
TRUE
;
updating_ui
=
TRUE
;
if
(
current_app
)
buf
=
get_reg_keyW
(
config_key
,
explorer_desktopsW
,
desktop_name
,
NULL
);
if
(
buf
&&
(
bufindex
=
strchrW
(
buf
,
'x'
)))
{
{
disable
(
IDC_ENABLE_DESKTOP
);
*
bufindex
=
0
;
disable
(
IDC_DESKTOP_WIDTH
);
++
bufindex
;
disable
(
IDC_DESKTOP_HEIGHT
);
SetWindowTextW
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_WIDTH
),
buf
);
disable
(
IDC_DESKTOP_SIZE
);
SetWindowTextW
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_HEIGHT
),
bufindex
);
disable
(
IDC_DESKTOP_BY
);
}
else
{
return
;
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_WIDTH
),
"800"
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_HEIGHT
),
"600"
);
}
}
enable
(
IDC_ENABLE_DESKTOP
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
/* do we have desktop mode enabled? */
/* do we have desktop mode enabled? */
if
(
reg_key_exists
(
config_key
,
keypath
(
"
X11 Driv
er"
),
"Desktop"
))
if
(
reg_key_exists
(
config_key
,
keypath
(
"
Explor
er"
),
"Desktop"
))
{
{
char
*
buf
,
*
bufindex
;
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_CHECKED
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
,
"800x600"
);
/* note: this test must match the one in x11drv */
if
(
buf
[
0
]
!=
'n'
&&
buf
[
0
]
!=
'N'
&&
buf
[
0
]
!=
'F'
&&
buf
[
0
]
!=
'f'
&&
buf
[
0
]
!=
'0'
)
{
desktopenabled
=
TRUE
;
enable
(
IDC_DESKTOP_WIDTH
);
enable
(
IDC_DESKTOP_WIDTH
);
enable
(
IDC_DESKTOP_HEIGHT
);
enable
(
IDC_DESKTOP_HEIGHT
);
enable
(
IDC_DESKTOP_SIZE
);
enable
(
IDC_DESKTOP_SIZE
);
enable
(
IDC_DESKTOP_BY
);
enable
(
IDC_DESKTOP_BY
);
bufindex
=
strchr
(
buf
,
'x'
);
if
(
bufindex
)
{
*
bufindex
=
0
;
++
bufindex
;
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_WIDTH
),
buf
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_HEIGHT
),
bufindex
);
}
else
{
WINE_TRACE
(
"Desktop registry entry is malformed
\n
"
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_WIDTH
),
"800"
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_HEIGHT
),
"600"
);
}
}
}
else
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
if
(
!
desktopenabled
)
{
{
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_UNCHECKED
);
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_UNCHECKED
);
disable
(
IDC_DESKTOP_WIDTH
);
disable
(
IDC_DESKTOP_WIDTH
);
disable
(
IDC_DESKTOP_HEIGHT
);
disable
(
IDC_DESKTOP_HEIGHT
);
disable
(
IDC_DESKTOP_SIZE
);
disable
(
IDC_DESKTOP_SIZE
);
disable
(
IDC_DESKTOP_BY
);
disable
(
IDC_DESKTOP_BY
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_WIDTH
),
""
);
SetWindowText
(
GetDlgItem
(
dialog
,
IDC_DESKTOP_HEIGHT
),
""
);
}
}
updating_ui
=
FALSE
;
updating_ui
=
FALSE
;
...
@@ -126,6 +127,7 @@ static void init_dialog(HWND dialog)
...
@@ -126,6 +127,7 @@ static void init_dialog(HWND dialog)
unsigned
int
it
;
unsigned
int
it
;
char
*
buf
;
char
*
buf
;
convert_x11_desktop_key
();
update_gui_for_desktop_mode
(
dialog
);
update_gui_for_desktop_mode
(
dialog
);
updating_ui
=
TRUE
;
updating_ui
=
TRUE
;
...
@@ -182,29 +184,36 @@ static void init_dialog(HWND dialog)
...
@@ -182,29 +184,36 @@ static void init_dialog(HWND dialog)
updating_ui
=
FALSE
;
updating_ui
=
FALSE
;
}
}
static
void
set_from_desktop_edits
(
HWND
dialog
)
{
static
void
set_from_desktop_edits
(
HWND
dialog
)
char
*
width
,
*
height
,
*
new
;
{
static
const
WCHAR
x
[]
=
{
'x'
,
0
};
static
const
WCHAR
def_width
[]
=
{
'8'
,
'0'
,
'0'
,
0
};
static
const
WCHAR
def_height
[]
=
{
'6'
,
'0'
,
'0'
,
0
};
WCHAR
*
width
,
*
height
,
*
new
;
const
WCHAR
*
desktop_name
=
current_app
?
current_app
:
defaultW
;
if
(
updating_ui
)
return
;
if
(
updating_ui
)
return
;
WINE_TRACE
(
"
\n
"
);
WINE_TRACE
(
"
\n
"
);
width
=
get_text
(
dialog
,
IDC_DESKTOP_WIDTH
);
width
=
get_text
W
(
dialog
,
IDC_DESKTOP_WIDTH
);
height
=
get_text
(
dialog
,
IDC_DESKTOP_HEIGHT
);
height
=
get_text
W
(
dialog
,
IDC_DESKTOP_HEIGHT
);
if
(
width
==
NULL
||
strcmp
(
width
,
""
)
==
0
)
{
if
(
!
width
||
!
width
[
0
]
)
{
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
width
=
strdup
A
(
"800"
);
width
=
strdup
W
(
def_width
);
}
}
if
(
!
height
||
!
height
[
0
])
{
if
(
height
==
NULL
||
strcmp
(
height
,
""
)
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
height
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
height
=
strdup
A
(
"600"
);
height
=
strdup
W
(
def_height
);
}
}
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
width
)
+
strlen
(
height
)
+
2
/* x + terminator */
);
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
width
)
+
strlenW
(
height
)
+
2
)
*
sizeof
(
WCHAR
));
sprintf
(
new
,
"%sx%s"
,
width
,
height
);
strcpyW
(
new
,
width
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
,
new
);
strcatW
(
new
,
x
);
strcatW
(
new
,
height
);
set_reg_keyW
(
config_key
,
explorer_desktopsW
,
desktop_name
,
new
);
set_reg_keyW
(
config_key
,
keypathW
(
explorerW
),
desktopW
,
desktop_name
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
...
@@ -217,7 +226,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
...
@@ -217,7 +226,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DESKTOP
)
==
BST_CHECKED
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DESKTOP
)
==
BST_CHECKED
)
{
set_from_desktop_edits
(
dialog
);
set_from_desktop_edits
(
dialog
);
}
else
{
}
else
{
set_reg_key
(
config_key
,
keypath
(
"
X11 Driv
er"
),
"Desktop"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
"
Explor
er"
),
"Desktop"
,
NULL
);
}
}
update_gui_for_desktop_mode
(
dialog
);
update_gui_for_desktop_mode
(
dialog
);
...
...
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