From e5d06c7ca9b2277e0e7a91acfb5ecb7c2d7683a9 Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Sun, 18 Sep 2005 12:28:42 +0000 Subject: [PATCH] fix typo for GTK_VER; define HAVE_CONFIG_H cause gtkprogressbar.c has 2005-09-18 Hans Breuer * gtk/makefile.msc.in : fix typo for GTK_VER; define HAVE_CONFIG_H cause gtkprogressbar.c has #include conditionally; less noise from generated gtk.def * gtk/stock-icons/makefile.msc gdk/makefile.msc tests/makefile.msc : updated * gtk/gtktrayicon-win32.c : dummy implmentation to make gtk compile. For me it works as well as the *NIX implemenation, that is not at all. * gdk/win32/gdkproperty-win32.c : implement gdk_atom_intern_static_string() * gdk/win32/gdkwindow-win32.c(gdk_window_set_urgency_hint) : only use only use (WINVER >= 0x0500) when available from the SDK. Otherwise fall back to true dynamic linking of FlashWindowEx. Makes gtk+ work on NT4.0 again - if compiled properly. * tests/teststatusicon.c : don't use GNOME icons for testing, but icons already coming with Gtk+. Makes it compile on win32. --- ChangeLog | 20 +++++++++++ ChangeLog.pre-2-10 | 20 +++++++++++ gdk/makefile.msc | 4 ++- gdk/win32/gdkproperty-win32.c | 9 +++++ gdk/win32/gdkwindow-win32.c | 34 +++++++++++++++++-- gtk/gtktrayicon-win32.c | 64 +++++++++++++++++++++++++++++++++++ gtk/makefile.msc.in | 4 ++- gtk/stock-icons/makefile.msc | 2 ++ tests/makefile.msc | 2 +- tests/teststatusicon.c | 22 ++++++------ 10 files changed, 164 insertions(+), 17 deletions(-) create mode 100644 gtk/gtktrayicon-win32.c diff --git a/ChangeLog b/ChangeLog index 62b6a330d4..82f53a424d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2005-09-18 Hans Breuer + + * gtk/makefile.msc.in : fix typo for GTK_VER; define HAVE_CONFIG_H + cause gtkprogressbar.c has #include conditionally; less + noise from generated gtk.def + * gtk/stock-icons/makefile.msc gdk/makefile.msc tests/makefile.msc : updated + + * gtk/gtktrayicon-win32.c : dummy implmentation to make gtk compile. + For me it works as well as the *NIX implemenation, that is not at all. + + * gdk/win32/gdkproperty-win32.c : implement gdk_atom_intern_static_string() + + * gdk/win32/gdkwindow-win32.c(gdk_window_set_urgency_hint) : only use + only use (WINVER >= 0x0500) when available from the SDK. Otherwise fall + back to true dynamic linking of FlashWindowEx. Makes gtk+ work on NT4.0 + again - if compiled properly. + + * tests/teststatusicon.c : don't use GNOME icons for testing, but icons + already coming with Gtk+. Makes it compile on win32. + 2005-09-18 Guilherme de S. Pastore * README.cvs-commits: fixed some tiny typos diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 62b6a330d4..82f53a424d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,23 @@ +2005-09-18 Hans Breuer + + * gtk/makefile.msc.in : fix typo for GTK_VER; define HAVE_CONFIG_H + cause gtkprogressbar.c has #include conditionally; less + noise from generated gtk.def + * gtk/stock-icons/makefile.msc gdk/makefile.msc tests/makefile.msc : updated + + * gtk/gtktrayicon-win32.c : dummy implmentation to make gtk compile. + For me it works as well as the *NIX implemenation, that is not at all. + + * gdk/win32/gdkproperty-win32.c : implement gdk_atom_intern_static_string() + + * gdk/win32/gdkwindow-win32.c(gdk_window_set_urgency_hint) : only use + only use (WINVER >= 0x0500) when available from the SDK. Otherwise fall + back to true dynamic linking of FlashWindowEx. Makes gtk+ work on NT4.0 + again - if compiled properly. + + * tests/teststatusicon.c : don't use GNOME icons for testing, but icons + already coming with Gtk+. Makes it compile on win32. + 2005-09-18 Guilherme de S. Pastore * README.cvs-commits: fixed some tiny typos diff --git a/gdk/makefile.msc b/gdk/makefile.msc index 66bb791d2a..bb8d147151 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -154,7 +154,9 @@ gdkaliasdef.c: gdk.symbols gdk.def: gdk.symbols echo EXPORTS > gdk.def - cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 -DALL_FILES gdk.symbols >> gdk.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 -DALL_FILES \ + -DG_GNUC_CONST= \ + gdk.symbols >> gdk.def libgdk-win32-$(GTK_VER)-0.dll : $(gdk_OBJECTS) gdk.def win32\gdk-win32.lib $(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \ diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 21ca464d2d..5eff72add0 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -84,6 +84,15 @@ gdk_atom_intern (const gchar *atom_name, return retval; } +GdkAtom +gdk_atom_intern_static_string (const gchar *atom_name) +{ + /* on X11 this is supposed to save memory. On win32 there seems to be + * no way to make a difference ? + */ + return gdk_atom_intern (atom_name, FALSE); +} + gchar * gdk_atom_name (GdkAtom atom) { diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 81d764cc40..5c2f5a095e 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -29,9 +29,6 @@ #include #include -#define _WIN32_WINNT 0x0500 -#define WINVER _WIN32_WINNT - #include "gdk.h" /* gdk_rectangle_intersect */ #include "gdkevents.h" #include "gdkpixmap.h" @@ -1574,6 +1571,8 @@ void gdk_window_set_urgency_hint (GdkWindow *window, gboolean urgent) { +#if (WINVER >= 0x0500) + FLASHWINFO flashwinfo; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -1592,6 +1591,35 @@ gdk_window_set_urgency_hint (GdkWindow *window, flashwinfo.dwTimeout = 0; FlashWindowEx (&flashwinfo); +#else + struct _FLASHWINDOW + { + UINT cbSize; + HWND hwnd; + DWORD dwFlags; + UINT uCount; + DWORD dwTimeout; + } flashwindow = { sizeof(flashwindow), GDK_WINDOW_HWND (window), urgent ? 0x07 : 0x0, 0, 0 }; + typedef BOOL (*PFN_FlashWindowEx) (struct _FLASHWINDOW); + PFN_FlashWindowEx flashWindowEx = NULL; + gboolean once = TRUE; + + g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + + if (GDK_WINDOW_DESTROYED (window)) + return; + + if (once) + { + flashWindowEx = (PFN_FlashWindowEx)GetProcAddress (GetModuleHandle ("user32.dll"), "FlashWindowEx"); + once = FALSE; + } + if (flashWindowEx) + flashWindowEx(flashwindow); + else + FlashWindow (GDK_WINDOW_HWND (window), urgent); +#endif } void diff --git a/gtk/gtktrayicon-win32.c b/gtk/gtktrayicon-win32.c new file mode 100644 index 0000000000..d89fe0b216 --- /dev/null +++ b/gtk/gtktrayicon-win32.c @@ -0,0 +1,64 @@ +/* gtktrayicon.c + * Copyright (C) 2002 Anders Carlsson + * Copyright (C) 2005 Hans Breuer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * This is an implementation of the gtktrayicon interface *not* + * following the freedesktop.org "system tray" spec, + * http://www.freedesktop.org/wiki/Standards/systemtray-spec + */ + +#include +#include +#include + +#include "gtkintl.h" +#include "gtkprivate.h" +#include "gtktrayicon.h" + +#include "gtkalias.h" + +G_DEFINE_TYPE (GtkTrayIcon, gtk_tray_icon, GTK_TYPE_PLUG); + +static void +gtk_tray_icon_class_init (GtkTrayIconClass *class) +{ +} + +static void +gtk_tray_icon_init (GtkTrayIcon *icon) +{ +} + +GtkTrayIcon * +_gtk_tray_icon_new (const gchar *name) +{ + return g_object_new (GTK_TYPE_TRAY_ICON, + "title", name, + NULL); +} + +GtkOrientation +_gtk_tray_icon_get_orientation (GtkTrayIcon *icon) +{ + g_return_val_if_fail (GTK_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL); + //FIXME: should we deliver the orientation of the tray ?? + return GTK_ORIENTATION_VERTICAL; +} + diff --git a/gtk/makefile.msc.in b/gtk/makefile.msc.in index ef14f651e5..3573c7fbe6 100644 --- a/gtk/makefile.msc.in +++ b/gtk/makefile.msc.in @@ -455,7 +455,9 @@ generated : $(GENERATED) gtk.def: gtk.symbols makefile.msc echo EXPORTS > gtk.def - cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES gtk.symbols >> gtk.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES \ + -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= \ + gtk.symbols >> gtk.def gtkalias.h: gtk.symbols cl /EP -DG_OS_WIN32 -DGTK_WINDOWING_WIN32 -DINCLUDE_INTERNAL_SYMBOLS gtk.symbols | $(PERL) makegtkalias.pl > gtkalias.h diff --git a/gtk/stock-icons/makefile.msc b/gtk/stock-icons/makefile.msc index b27a387f18..1913e46a54 100644 --- a/gtk/stock-icons/makefile.msc +++ b/gtk/stock-icons/makefile.msc @@ -143,6 +143,8 @@ VARIABLES2 = \ stock_search_24 stock_search_24.png \ stock_search_replace_16 stock_search_replace_16.png \ stock_search_replace_24 stock_search_replace_24.png \ + stock_select_all_16 stock_select_all_16.png \ + stock_select_all_24 stock_select_all_24.png \ stock_sort_ascending_16 stock_sort_ascending_16.png \ stock_sort_ascending_24 stock_sort_ascending_24.png \ stock_sort_descending_16 stock_sort_descending_16.png \ diff --git a/tests/makefile.msc b/tests/makefile.msc index f0891c2c1b..778db5e3c8 100644 --- a/tests/makefile.msc +++ b/tests/makefile.msc @@ -53,7 +53,7 @@ TESTAPPS = \ testtext testtextbuffer testtoolbar \ testtreecolumns testtreeedit testtreeflow testtreefocus \ testtreesort testtreeview treestoretest \ - testsocket testsocket_child \ + testsocket testsocket_child teststatusicon \ testthreads testxinerama \ simple diff --git a/tests/teststatusicon.c b/tests/teststatusicon.c index 467baf5dd5..738181d30d 100755 --- a/tests/teststatusicon.c +++ b/tests/teststatusicon.c @@ -25,11 +25,11 @@ typedef enum { - TEST_STATUS_FILE, - TEST_STATUS_DIRECTORY + TEST_STATUS_INFO, + TEST_STATUS_QUESTION } TestStatus; -static TestStatus status = TEST_STATUS_FILE; +static TestStatus status = TEST_STATUS_INFO; static gint timeout = 0; static void @@ -38,15 +38,15 @@ update_icon (GtkStatusIcon *status_icon) gchar *icon_name; gchar *tooltip; - if (status == TEST_STATUS_FILE) + if (status == TEST_STATUS_INFO) { - icon_name = "gnome-fs-regular"; - tooltip = "Regular File"; + icon_name = GTK_STOCK_DIALOG_INFO; + tooltip = "Some Infromation ..."; } else { - icon_name = "gnome-fs-directory"; - tooltip = "Directory"; + icon_name = GTK_STOCK_DIALOG_QUESTION; + tooltip = "Some Question ..."; } gtk_status_icon_set_from_icon_name (status_icon, icon_name); @@ -58,10 +58,10 @@ timeout_handler (gpointer data) { GtkStatusIcon *icon = GTK_STATUS_ICON (data); - if (status == TEST_STATUS_FILE) - status = TEST_STATUS_DIRECTORY; + if (status == TEST_STATUS_INFO) + status = TEST_STATUS_QUESTION; else - status = TEST_STATUS_FILE; + status = TEST_STATUS_INFO; update_icon (icon);