[1/5] explorer: Add non-functional start button.

Vincent Povirk madewokherd at gmail.com
Tue Jan 7 16:36:08 CST 2014


Unlike the previous series, this one doesn't show the systray window
unconditionally by default.

I'm still looking for a way to prevent the virtual desktop from
automatically closing when the last process is closed, in the "shell"
mode where the systray window is unconditionally shown, as there's now
an expectation that one can use the desktop to start something else.
This is a hard problem because the decision of whether to close the
desktop needs to be made in wineserver (in order to do it safely and
avoid the possibility of something starting inside a desktop window
that's being destroyed), and wineserver knows nothing about this
alternative mode, or about wineboot's role in the shutdown process.
-------------- next part --------------
From ffc298da48925d8876e4f8fad357b84231d37ba8 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 5 Dec 2013 16:29:31 -0600
Subject: [PATCH 1/5] explorer: Add non-functional start button.

---
 programs/explorer/explorer.rc |  1 +
 programs/explorer/resource.h  |  1 +
 programs/explorer/systray.c   | 25 ++++++++++++++++++++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/programs/explorer/explorer.rc b/programs/explorer/explorer.rc
index ae9f44a..86ec4e3 100644
--- a/programs/explorer/explorer.rc
+++ b/programs/explorer/explorer.rc
@@ -29,6 +29,7 @@ STRINGTABLE
 {
     IDS_EXPLORER_TITLE  "Wine Explorer"
     IDS_PATHBOX_LABEL   "Location:"
+    IDS_START_LABEL     "Start"
 }
 
 #define WINE_FILEDESCRIPTION_STR "Wine Explorer"
diff --git a/programs/explorer/resource.h b/programs/explorer/resource.h
index dc0e8d1..a7f3f3a 100644
--- a/programs/explorer/resource.h
+++ b/programs/explorer/resource.h
@@ -23,5 +23,6 @@
 
 #define IDS_EXPLORER_TITLE 1
 #define IDS_PATHBOX_LABEL 2
+#define IDS_START_LABEL 3
 
 #endif
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c
index c15fbf0..8cc75ae 100644
--- a/programs/explorer/systray.c
+++ b/programs/explorer/systray.c
@@ -30,6 +30,7 @@
 #include <wine/list.h>
 
 #include "explorer_private.h"
+#include "resource.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(systray);
 
@@ -91,6 +92,8 @@ static int icon_cx, icon_cy, tray_width;
 static struct icon *balloon_icon;
 static HWND balloon_window;
 
+static HWND start_button;
+
 #define MIN_DISPLAYED 8
 #define ICON_BORDER  2
 
@@ -135,7 +138,7 @@ static void init_common_controls(void)
         INITCOMMONCONTROLSEX init_tooltip;
 
         init_tooltip.dwSize = sizeof(INITCOMMONCONTROLSEX);
-        init_tooltip.dwICC = ICC_TAB_CLASSES;
+        init_tooltip.dwICC = ICC_TAB_CLASSES|ICC_STANDARD_CLASSES;
 
         InitCommonControlsEx(&init_tooltip);
         initialized = TRUE;
@@ -628,11 +631,24 @@ static LRESULT WINAPI tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
     return 0;
 }
 
+static void get_system_text_size( const WCHAR *text, SIZE *size )
+{
+    /* FIXME: Implement BCM_GETIDEALSIZE and use that instead. */
+    HDC hdc = CreateCompatibleDC(0);
+
+    GetTextExtentPointW(hdc, text, lstrlenW(text), size);
+
+    DeleteDC(hdc);
+}
+
 /* this function creates the listener window */
 void initialize_systray( HMODULE graphics_driver, BOOL using_root )
 {
     WNDCLASSEXW class;
     static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
+    static const WCHAR button_class[] = {'B','u','t','t','o','n',0};
+    WCHAR start_label[50];
+    SIZE start_text_size;
 
     wine_notify_icon = (void *)GetProcAddress( graphics_driver, "wine_notify_icon" );
 
@@ -667,5 +683,12 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root )
         return;
     }
 
+    LoadStringW( NULL, IDS_START_LABEL, start_label, sizeof(start_label)/sizeof(WCHAR) );
+
+    get_system_text_size( start_label, &start_text_size );
+
+    start_button = CreateWindowW( button_class, start_label, WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
+        0, 0, start_text_size.cx + 8, icon_cy, tray_window, 0, 0, 0 );
+
     if (hide_systray) do_hide_systray();
 }
-- 
1.8.1.2



More information about the wine-patches mailing list