diff options
author | Tor Lillqvist <tml@novell.com> | 2008-06-11 16:05:28 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2008-06-11 16:05:28 +0000 |
commit | b981e4ff37484adc4acfe501fd3d98873c5bc5fd (patch) | |
tree | 6cbc8f8eb5050f0f97e5ee5c97a6be46b204ca06 | |
parent | 6f25f771c5e36876cbcc27e13eb463c9c2311f23 (diff) | |
download | gtk+-b981e4ff37484adc4acfe501fd3d98873c5bc5fd.tar.gz |
As we don't support Win9x anyway, we can use ProcessIdToSessionId()
2008-06-11 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkdisplay-win32.c (gdk_display_get_name): As we don't
support Win9x anyway, we can use ProcessIdToSessionId()
unconditionally.
svn path=/trunk/; revision=20353
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gdk/win32/gdkdisplay-win32.c | 36 |
2 files changed, 13 insertions, 29 deletions
@@ -1,3 +1,9 @@ +2008-06-11 Tor Lillqvist <tml@novell.com> + + * gdk/win32/gdkdisplay-win32.c (gdk_display_get_name): As we don't + support Win9x anyway, we can use ProcessIdToSessionId() + unconditionally. + 2008-06-11 Michael Natterer <mitch@imendio.com> * gtk/gtkfilechooserbutton.c: fix local prototype of diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index cc0246c655..43dcb74575 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -184,33 +184,6 @@ _gdk_monitor_init (void) } -/* - * Dynamic version of ProcessIdToSessionId() form Terminal Service. - * It is only returning something else than 0 when running under - * Terminal Service, available since NT4 SP4 and not for win9x - */ -static guint -get_session_id (void) -{ - typedef BOOL (WINAPI *t_ProcessIdToSessionId) (DWORD, DWORD*); - static t_ProcessIdToSessionId p_ProcessIdToSessionId = NULL; - static HMODULE kernel32 = NULL; - DWORD id = 0; - - if (kernel32 == NULL) - { - kernel32 = GetModuleHandle ("kernel32.dll"); - - g_assert (kernel32 != NULL); - - p_ProcessIdToSessionId = (t_ProcessIdToSessionId) GetProcAddress (kernel32, "ProcessIdToSessionId"); - } - if (p_ProcessIdToSessionId) - p_ProcessIdToSessionId (GetCurrentProcessId (), &id); /* got it (or not ;) */ - - return id; -} - GdkDisplay * gdk_display_open (const gchar *display_name) { @@ -265,6 +238,7 @@ gdk_display_get_name (GdkDisplay *display) HWINSTA hwinsta = GetProcessWindowStation (); char *window_station_name; DWORD n; + DWORD session_id; char *display_name; static const char *display_name_cache = NULL; @@ -301,8 +275,12 @@ gdk_display_get_name (GdkDisplay *display) window_station_name = "WinSta0"; } - display_name = g_strdup_printf ("%d\\%s\\%s", - get_session_id (), window_station_name, + if (!ProcessIdToSessionId (GetCurrentProcessId (), &session_id)) + session_id = 0; + + display_name = g_strdup_printf ("%ld\\%s\\%s", + session_id, + window_station_name, desktop_name); GDK_NOTE (MISC, g_print ("gdk_display_get_name: %s\n", display_name)); |