When running `wine explorer.exe /desktop=shell` as a full-screen app, there is no obvious way to close it and return to the Linux desktop. Remedy that problem by adding an "Exit desktop" button to the Start menu in the same place as the "Shut Down" button on Windows.
From: Alex Henrie alexhenrie24@gmail.com
When running `wine explorer.exe /desktop=shell` as a full-screen app, there is no obvious way to close it and return to the Linux desktop. Remedy that problem by adding an "Exit desktop" button to the Start menu in the same place as the "Shut Down" button on Windows. --- programs/explorer/explorer.rc | 2 ++ programs/explorer/resource.h | 2 ++ programs/explorer/startmenu.c | 30 ++++++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/programs/explorer/explorer.rc b/programs/explorer/explorer.rc index 42c02437e78..1f496f7248c 100644 --- a/programs/explorer/explorer.rc +++ b/programs/explorer/explorer.rc @@ -32,6 +32,8 @@ STRINGTABLE IDS_PATHBOX_LABEL "Location:" IDS_START_LABEL "Start" IDS_RUN "&Run..." + IDS_EXIT_LABEL "E&xit desktop" + IDS_EXIT_PROMPT "Are you sure you want to close all programs and exit the virtual desktop?" }
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/programs/explorer/resource.h b/programs/explorer/resource.h index 747dd03dcaa..8ce62cbe962 100644 --- a/programs/explorer/resource.h +++ b/programs/explorer/resource.h @@ -25,5 +25,7 @@ #define IDS_PATHBOX_LABEL 2 #define IDS_START_LABEL 3 #define IDS_RUN 4 +#define IDS_EXIT_LABEL 5 +#define IDS_EXIT_PROMPT 6
#endif diff --git a/programs/explorer/startmenu.c b/programs/explorer/startmenu.c index 489a81f94b9..63120026dad 100644 --- a/programs/explorer/startmenu.c +++ b/programs/explorer/startmenu.c @@ -53,6 +53,7 @@ static struct menu_item public_startmenu; static struct menu_item user_startmenu;
#define MENU_ID_RUN 1 +#define MENU_ID_EXIT 2
static ULONG copy_pidls(struct menu_item* item, LPITEMIDLIST dest) { @@ -383,6 +384,17 @@ static void run_dialog(void) FreeLibrary(hShell32); }
+static void shut_down(HWND hwnd) +{ + WCHAR prompt[256]; + int ret; + + LoadStringW(NULL, IDS_EXIT_PROMPT, prompt, ARRAY_SIZE(prompt)); + ret = MessageBoxW(hwnd, prompt, L"Wine", MB_YESNO|MB_ICONQUESTION|MB_SYSTEMMODAL); + if (ret == IDYES) + ExitWindows(0, 0); +} + LRESULT menu_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) @@ -419,6 +431,8 @@ LRESULT menu_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) exec_item(item); else if (mii.wID == MENU_ID_RUN) run_dialog(); + else if (mii.wID == MENU_ID_EXIT) + shut_down(hwnd);
destroy_menus();
@@ -436,7 +450,7 @@ void do_startmenu(HWND hwnd) MENUITEMINFOW mii; RECT rc={0,0,0,0}; TPMPARAMS tpm; - WCHAR run_label[50]; + WCHAR label[64];
destroy_menus();
@@ -475,13 +489,21 @@ void do_startmenu(HWND hwnd) if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl))) add_shell_item(&root_menu, pidl);
- LoadStringW(NULL, IDS_RUN, run_label, ARRAY_SIZE(run_label)); - + LoadStringW(NULL, IDS_RUN, label, ARRAY_SIZE(label)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_STRING|MIIM_ID; - mii.dwTypeData = run_label; + mii.dwTypeData = label; mii.wID = MENU_ID_RUN; + InsertMenuItemW(root_menu.menuhandle, -1, TRUE, &mii); + + mii.fMask = MIIM_FTYPE; + mii.fType = MFT_SEPARATOR; + InsertMenuItemW(root_menu.menuhandle, -1, TRUE, &mii);
+ LoadStringW(NULL, IDS_EXIT_LABEL, label, ARRAY_SIZE(label)); + mii.fMask = MIIM_STRING|MIIM_ID; + mii.dwTypeData = label; + mii.wID = MENU_ID_EXIT; InsertMenuItemW(root_menu.menuhandle, -1, TRUE, &mii);
mi.cbSize = sizeof(mi);
This merge request was approved by Esme Povirk.