12012-02-13	Nicolas Setton  <setton@adacore.com>
2
3	* gdk/win32/gdkwindow-win32.c: This makes menus, popups and tooltips
4	show above the windows task bar.
5        For L213-019.
6
7	Backport of <http://git.gnome.org/browse/gtk+/commit/?id=62b505174f16743833467290f49c1ae09c25448e>
8
92012-01-12	Arnaud Charlet  <charlet@adacore.com>
10
11	* modules/engines/ms-windows/msw_style.c (draw_themed_tab_button): Fix
12	memory leak.
13	For L109-030
14
152012-01-06	Nicolas Setton	<setton@adacore.com>
16
17	* gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): Do not
18	discard key events with state CTRL + ALT, as some keyboards do use this
19	key combination for legitimate character input.
20	* gdkevents-win32.c(build_key_event_state): Detect CTRL + ALT as an
21	equivalent group to ALT_GR.
22	For K517-001.
23
242011-11-30	Arnaud Charlet  <charlet@adacore.com>
25
26	* gdk/win32/gdkpixmap-win32.c (_gdk_pixmap_new): Add fallback code
27	for 15/16bits depth display.
28	For KB10-052. Backport of Gtk+ trunk, see
29	https://bugzilla.gnome.org/show_bug.cgi?id=665013
30
312011-07-26	Nicolas Setton  <setton@adacore.com>
32
33	* gtk/gtkimcontextsimple.c (check_win32_special_cases): Fix handling
34	of special cases for dead acute and dead diaeresis under Win32. For
35	these characters followed by a space, emit an apostrophe and double
36	quotes respectively.
37	Submitted at https://bugzilla.gnome.org/show_bug.cgi?id=655357
38
392011-07-22	Arnaud Charlet  <charlet@adacore.com>
40
41	* gdk/win32/gdkdisplay-win32.c (inner_clipboard_window_procedure): Fix
42	build with --disable-debug
43
442011-04-10      Arnaud Charlet  <charlet@adacore.com>
45
46	* modules/engines/ms-windows/msw_style.c (draw_tab_button): Always use
47	custom code to draw tab.
48	Submitted at https://bugzilla.gnome.org/show_bug.cgi?id=647461
49
502010-02-01      Arnaud Charlet  <charlet@adacore.com>
51
52	* gdk/win32/gdkdrawable-win32.c	(draw_segments): Ignore LineTo
53	errors.
54
552009-07-20	Arnaud Charlet	<charlet@adacore.com>
56
57	* configure: Work around ^M handling on cygwin with igncr
58
592006-06-05	Arnaud Charlet	<charlet@adacore.com>
60
61	* gdk/win32/gdkgc-win32.c (_gdk_win32_gdkregion_to_hrgn): Disable
62	harmless warning which is occurring often with Gtk+ >= 2.8.18
63
642002-11-25	Arnaud Charlet	<charlet@adacore.com>
65
66	* gdk/Makefile.in: Remove gdk-win32res.o dependency,
67	since we do not want to use the default Gtk+ icon.
68
69--- gdk/Makefile.in.orig	2010-09-23 16:27:22.000000000 +0200
70+++ gdk/Makefile.in	2010-10-08 11:06:41.724000000 +0200
71@@ -664,8 +664,8 @@ libgdk_quartz_2_0_la_LIBADD = quartz/lib
72 libgdk_quartz_2_0_la_LDFLAGS = $(LDADD)
73 libgdk_win32_2_0_la_SOURCES = $(common_sources) gdkkeynames.c
74 libgdk_win32_2_0_la_LIBADD = win32/libgdk-win32.la $(GDK_DEP_LIBS)
75-libgdk_win32_2_0_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def
76-libgdk_win32_2_0_la_LDFLAGS = -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def $(LDADD)
77+libgdk_win32_2_0_la_DEPENDENCIES = win32/libgdk-win32.la gdk.def
78+libgdk_win32_2_0_la_LDFLAGS = -export-symbols $(srcdir)/gdk.def $(LDADD)
79 @HAVE_INTROSPECTION_TRUE@introspection_files = $(filter-out \
80 @HAVE_INTROSPECTION_TRUE@	gdkkeysyms-compat.h, \
81 @HAVE_INTROSPECTION_TRUE@	$(gdk_public_h_sources)) \
82--- gdk/win32/gdkgc-win32.c.orig
83+++ gdk/win32/gdkgc-win32.c	2006-06-05 14:56:59.515625000 +0200
84@@ -1160,8 +1160,7 @@ _gdk_win32_gdkregion_to_hrgn (GdkRegion
85       if (rect->bottom > rgndata->rdh.rcBound.bottom)
86 	rgndata->rdh.rcBound.bottom = rect->bottom;
87     }
88-  if ((hrgn = ExtCreateRegion (NULL, nbytes, rgndata)) == NULL)
89-    WIN32_API_FAILED ("ExtCreateRegion");
90+  hrgn = ExtCreateRegion (NULL, nbytes, rgndata);
91
92   g_free (rgndata);
93
94--- configure.old	2009-02-23 15:54:03.650263500 +0100
95+++ configure	2009-02-23 15:54:54.711263500 +0100
96@@ -36969,6 +36971,7 @@ if test "$ac_cs_awk_cr" = "a${ac_cr}b";
97 else
98   ac_cs_awk_cr=$ac_cr
99 fi
100+ac_cs_awk_cr=$ac_cr
101
102 echo 'BEGIN {' >"$tmp/subs1.awk" &&
103 _ACEOF
104--- gdk/win32/gdkdrawable-win32.c.old	2010-01-31 18:48:07.679800000 +0100
105+++ gdk/win32/gdkdrawable-win32.c	2010-01-31 18:48:32.429800000 +0100
106@@ -1246,7 +1246,7 @@ draw_segments (GdkGCWin32 *gcwin32,
107
108 	  GDK_NOTE (DRAW, g_print (" +%d+%d..+%d+%d", x1, y1, x2, y2));
109 	  GDI_CALL (MoveToEx, (hdc, x1, y1, NULL)) &&
110-	    GDI_CALL (LineTo, (hdc, x2, y2));
111+	    LineTo (hdc, x2, y2);
112 	}
113
114       GDK_NOTE (DRAW, g_print ("\n"));
115--- modules/engines/ms-windows/msw_style.c.old
116+++ modules/engines/ms-windows/msw_style.c
117@@ -2590,7 +2590,9 @@ draw_tab_button (GtkStyle *style,
118 		 const gchar *detail,
119 		 gint x, gint y, gint width, gint height, gint gap_side)
120 {
121+#if 0
122   if (gap_side == GTK_POS_TOP || gap_side == GTK_POS_BOTTOM)
123+#endif
124     {
125       /* experimental tab-drawing code from mozilla */
126       RECT rect;
127--- gdk/win32/gdkdisplay-win32.c.old	2011-07-22 12:06:42.618000000 +0200
128+++ gdk/win32/gdkdisplay-win32.c	2011-07-22 12:07:29.311000000 +0200
129@@ -386,7 +386,7 @@ inner_clipboard_window_procedure (HWND
130         if (_gdk_debug_flags & GDK_DEBUG_DND)
131           {
132             while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
133-              g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
134+              GDK_NOTE (DND, g_print ("%s ", _gdk_win32_cf_to_string (nFormat)));
135           }
136
137         GDK_NOTE (DND, g_print (" \n"));
138--- gtk/gtkimcontextsimple.c.original	2011-07-26 15:59:06.000000000 +0200
139+++ gtk/gtkimcontextsimple.c	2011-07-26 16:00:44.000000000 +0200
140@@ -302,9 +302,9 @@ check_win32_special_cases (GtkIMContextS
141       switch (context_simple->compose_buffer[0])
142 	{
143 	case GDK_dead_acute:
144-	  value = 0x00B4; break;
145+	  value = 0x0027; break;
146 	case GDK_dead_diaeresis:
147-	  value = 0x00A8; break;
148+	  value = 0x0022; break;
149 	}
150       if (value > 0)
151 	{
152--- gdk/win32/gdkpixmap-win32.c.old	2011-11-10 18:38:03.000000000 +0100
153+++ gdk/win32/gdkpixmap-win32.c	2012-01-12 12:53:16.705000000 +0100
154@@ -138,7 +138,6 @@ _gdk_pixmap_new (GdkDrawable *drawable,
155 		gint         depth)
156 {
157   HDC hdc;
158-  HPALETTE holdpal = NULL;
159   HBITMAP hbitmap;
160   GdkPixmap *pixmap;
161   GdkDrawableImplWin32 *drawable_impl;
162@@ -147,6 +146,7 @@ _gdk_pixmap_new (GdkDrawable *drawable,
163   gint window_depth;
164   cairo_surface_t *dib_surface, *image_surface;
165   cairo_format_t format;
166+  guchar *bits;
167
168   g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL);
169   g_return_val_if_fail ((drawable != NULL) || (depth != -1), NULL);
170@@ -175,6 +175,11 @@ _gdk_pixmap_new (GdkDrawable *drawable,
171       format = CAIRO_FORMAT_A8;
172       break;
173
174+    case 15:
175+    case 16:
176+      format = CAIRO_FORMAT_RGB16_565;
177+      break;
178+
179     case 24:
180     case 32:
181       format = CAIRO_FORMAT_RGB24;
182@@ -203,16 +208,93 @@ _gdk_pixmap_new (GdkDrawable *drawable,
183         gdk_drawable_set_colormap (pixmap, cmap);
184     }
185
186-  dib_surface = cairo_win32_surface_create_with_dib (format, width, height);
187-  if (dib_surface == NULL)
188+  if (depth != 15 && depth != 16)
189     {
190-      g_object_unref ((GObject *) pixmap);
191-      return NULL;
192+      dib_surface = cairo_win32_surface_create_with_dib (format, width, height);
193+      if (dib_surface == NULL)
194+	{
195+	  g_object_unref ((GObject *) pixmap);
196+	  return NULL;
197+	}
198+
199+      /* We need to have cairo create the dibsection for us, because
200+	 creating a cairo surface from a hdc only works for rgb24 format */
201+      hdc = cairo_win32_surface_get_dc (dib_surface);
202+
203+      /* Get the bitmap from the cairo hdc */
204+      hbitmap = GetCurrentObject (hdc, OBJ_BITMAP);
205+
206+      image_surface = cairo_win32_surface_get_image (dib_surface);
207+      bits = cairo_image_surface_get_data (image_surface);
208     }
209+  else
210+    {
211+      /* 16 bpp not supported by win32 cairo surface */
212+      struct {
213+	BITMAPINFOHEADER bmiHeader;
214+	union {
215+	  WORD bmiIndices[256];
216+	  DWORD bmiMasks[3];
217+	  RGBQUAD bmiColors[256];
218+	} u;
219+      } bmi;
220+      UINT iUsage;
221+      HWND hwnd;
222+      GdkVisual *visual;
223+
224+      if (GDK_IS_WINDOW (drawable))
225+	hwnd = GDK_WINDOW_HWND (drawable);
226+      else
227+	hwnd = GetDesktopWindow ();
228+      if ((hdc = GetDC (hwnd)) == NULL)
229+	{
230+	  WIN32_GDI_FAILED ("GetDC");
231+	  g_object_unref ((GObject *) pixmap);
232+	  return NULL;
233+	}
234+
235+      bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
236+      bmi.bmiHeader.biWidth = width;
237+      bmi.bmiHeader.biHeight = -height;
238+      bmi.bmiHeader.biPlanes = 1;
239+      bmi.bmiHeader.biBitCount = 16;
240+      bmi.bmiHeader.biCompression = BI_BITFIELDS;
241+      bmi.bmiHeader.biSizeImage = 0;
242+      bmi.bmiHeader.biXPelsPerMeter =
243+      bmi.bmiHeader.biYPelsPerMeter = 0;
244+      bmi.bmiHeader.biClrUsed = 0;
245+      bmi.bmiHeader.biClrImportant = 0;
246+
247+      iUsage = DIB_RGB_COLORS;
248+      visual = gdk_visual_get_system ();
249+      bmi.u.bmiMasks[0] = visual->red_mask;
250+      bmi.u.bmiMasks[1] = visual->green_mask;
251+      bmi.u.bmiMasks[2] = visual->blue_mask;
252+
253+      hbitmap = CreateDIBSection (hdc, (BITMAPINFO *) &bmi,
254+				  iUsage, (PVOID *) &bits, NULL, 0);
255+      GDI_CALL (ReleaseDC, (hwnd, hdc));
256+      if (hbitmap == NULL)
257+	{
258+	  WIN32_GDI_FAILED ("CreateDIBSection");
259+	  g_object_unref ((GObject *) pixmap);
260+	  return NULL;
261+	}
262+
263+      dib_surface = cairo_image_surface_create_for_data (bits,
264+							 format, width, height,
265+							 (width * 2 + 3) & ~3);
266+
267+      hdc = CreateCompatibleDC (NULL);
268+      if (!hdc)
269+	{
270+	  WIN32_GDI_FAILED ("CreateCompatibleDC");
271+	  g_object_unref ((GObject *) pixmap);
272+	  return NULL;
273+	}
274
275-  /* We need to have cairo create the dibsection for us, because
276-     creating a cairo surface from a hdc only works for rgb24 format */
277-  hdc = cairo_win32_surface_get_dc (dib_surface);
278+      SelectObject (hdc, hbitmap);
279+    }
280
281   /* We need to use the same hdc, because only one hdc
282      can render to the same bitmap */
283@@ -222,12 +304,8 @@ _gdk_pixmap_new (GdkDrawable *drawable,
284   /* No need to create a new surface when needed, as we have one already */
285   drawable_impl->cairo_surface = dib_surface;
286
287-  /* Get the bitmap from the cairo hdc */
288-  hbitmap = GetCurrentObject (hdc, OBJ_BITMAP);
289   drawable_impl->handle = hbitmap;
290-
291-  image_surface = cairo_win32_surface_get_image (dib_surface);
292-  pixmap_impl->bits = cairo_image_surface_get_data (image_surface);
293+  pixmap_impl->bits = bits;
294
295   gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap);
296
297--- gtk/gtkimcontextsimple.c.orig	2012-02-07 11:41:01.000000000 +0100
298+++ gtk/gtkimcontextsimple.c	2012-02-07 11:43:28.000000000 +0100
299@@ -877,7 +877,11 @@ gtk_im_context_simple_filter_keypress (G
300 	    event->keyval == GDK_ISO_Enter ||
301 	    event->keyval == GDK_KP_Enter)))
302 	{
303-	  return FALSE;
304+	  if ((event->state & GDK_MOD1_MASK) &&
305+	      (event->state & GDK_CONTROL_MASK))
306+	    return no_sequence_matches (context_simple, n_compose, event);
307+	  else
308+	    return FALSE;
309 	}
310     }
311
312*** gdk/win32/gdkevents-win32.c.orig	2012-01-06 16:46:38.000000000 +0100
313--- gdk/win32/gdkevents-win32.c	2012-01-06 16:47:13.000000000 +0100
314***************
315*** 671,676 ****
316--- 671,679 ----
317  	event->key.state |= GDK_CONTROL_MASK;
318        if (key_state[VK_MENU] & 0x80)
319  	event->key.state |= GDK_MOD1_MASK;
320+
321+       if ((key_state[VK_CONTROL] & 0x80) && (key_state[VK_MENU] & 0x80))
322+         event->key.group = 1;
323      }
324  }
325
326--- modules/engines/ms-windows/msw_style.c.old	2012-01-12 16:36:02.085000000 +0100
327+++ modules/engines/ms-windows/msw_style.c	2012-01-12 16:36:03.161000000 +0100
328@@ -2631,6 +2631,7 @@ draw_themed_tab_button (GtkStyle *style,
329   gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
330   cairo_paint (cr);
331   cairo_destroy (cr);
332+  g_object_unref (pixmap);
333
334   return TRUE;
335 }
336--- gdk/win32/gdkwindow-win32.c.orig	2012-02-13 19:46:48.000000000 +0100
337+++ gdk/win32/gdkwindow-win32.c	2012-02-13 19:47:42.000000000 +0100
338@@ -655,7 +655,7 @@ _gdk_window_impl_new (GdkWindow     *win
339       /* A temp window is not necessarily a top level window */
340       dwStyle = (_gdk_root == real_parent ? WS_POPUP : WS_CHILDWINDOW);
341       dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
342-      dwExStyle |= WS_EX_TOOLWINDOW;
343+      dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
344       offset_x = _gdk_offset_x;
345       offset_y = _gdk_offset_y;
346       break;
347@@ -1266,10 +1266,11 @@ show_window_internal (GdkWindow *window,
348     }
349
350   /* Sync STATE_ABOVE to TOPMOST */
351-  if (((private->state & GDK_WINDOW_STATE_ABOVE) &&
352+  if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TEMP &&
353+      (((private->state & GDK_WINDOW_STATE_ABOVE) &&
354        !(exstyle & WS_EX_TOPMOST)) ||
355       (!(private->state & GDK_WINDOW_STATE_ABOVE) &&
356-       (exstyle & WS_EX_TOPMOST)))
357+       (exstyle & WS_EX_TOPMOST))))
358     {
359       API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
360 			       (private->state & GDK_WINDOW_STATE_ABOVE)?HWND_TOPMOST:HWND_NOTOPMOST,
361@@ -3137,9 +3138,10 @@ update_style_bits (GdkWindow *window)
362   new_style = old_style;
363   new_exstyle = old_exstyle;
364
365-  if (private->window_type == GDK_WINDOW_TEMP ||
366-      impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
367-    new_exstyle |= WS_EX_TOOLWINDOW;
368+  if (private->window_type == GDK_WINDOW_TEMP)
369+    new_exstyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
370+  else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
371+    new_exstyle |= WS_EX_TOOLWINDOW ;
372   else
373     new_exstyle &= ~WS_EX_TOOLWINDOW;
374
375