summaryrefslogtreecommitdiff
path: root/gdk/win32
diff options
context:
space:
mode:
authorHans Breuer <hans@breuer.org>2004-05-02 13:20:49 +0000
committerHans Breuer <hans@src.gnome.org>2004-05-02 13:20:49 +0000
commit6efc9a6a1284194ceab50fe8fb2c138068b8c7f8 (patch)
treee63fa5258d4370aaf7ca683d7a7174db4904bc84 /gdk/win32
parenta516adebbed6d4c7ed9b8b4c3719ae623f989b01 (diff)
downloadgdk-pixbuf-6efc9a6a1284194ceab50fe8fb2c138068b8c7f8.tar.gz
don't modify the passed in GdkSegment(s) in place, we may get them again
2004-05-02 Hans Breuer <hans@breuer.org> * gdk/win32/gdkdrawable-win32.c (draw_segments) : don't modify the passed in GdkSegment(s) in place, we may get them again to draw at the same place. Fixes bug #129095, bug #137177, ... (draw_segments) draw the end pixel again to get the pixmap mask right, fixes bug #126710, #130202 * gdk/win32/gdkwindow-win32.c : use SetForegroundWindow, fixes bug #106013, John Ehresman * gtk/makefile.msc.in : don't try to link gtk.res but use gtk-win32.res (as supposed to be fixed below :)
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/gdkdrawable-win32.c42
-rw-r--r--gdk/win32/gdkwindow-win32.c15
2 files changed, 40 insertions, 17 deletions
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index acc6757f7..cd3c87418 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -1179,13 +1179,17 @@ draw_segments (GdkGCWin32 *gcwin32,
nsegs = va_arg (args, gint);
if (x_offset != 0 || y_offset != 0)
- for (i = 0; i < nsegs; i++)
- {
- segs[i].x1 -= x_offset;
- segs[i].y1 -= y_offset;
- segs[i].x2 -= x_offset;
- segs[i].y2 -= y_offset;
- }
+ {
+ /* must not modify in place, but could splice in the offset all below */
+ segs = g_memdup (segs, nsegs * sizeof (GdkSegment));
+ for (i = 0; i < nsegs; i++)
+ {
+ segs[i].x1 -= x_offset;
+ segs[i].y1 -= y_offset;
+ segs[i].x2 -= x_offset;
+ segs[i].y2 -= y_offset;
+ }
+ }
if (gcwin32->pen_dashes && !IS_WIN_NT ())
{
@@ -1237,18 +1241,32 @@ draw_segments (GdkGCWin32 *gcwin32,
* e.g. at xpm icons produced with gdk_pixbuf_new_from_xpm_data trough
* gdk_pixbuf_render_threshold_alpha (testgtk folder icon or
* Dia's toolbox icons) but only on win9x ... --hb
+ *
+ * Update : see bug #81895 and bug #126710 why this is finally
+ * needed on any win32 platform ;-)
*/
- if (gcwin32->pen_width <= 1 && !IS_WIN_NT())
+ if (gcwin32->pen_width <= 1)
{
GdkSegment *ps = &segs[nsegs-1];
- int xc = (ps->y2 == ps->y1) ? 0 : ((ps->x1 < ps->x2) ? 1 : -1);
- int yc = (ps->x2 == ps->x1) ? 0 : ((ps->y1 < ps->y2) ? 1 : -1);
- /* don't forget single point lines */
- xc = (0 == xc && 0 == yc) ? 1 : xc;
+ int xc = 0, yc = 0;
+
+ if (ps->y2 == ps->y1 && ps->x2 == ps->x1)
+ xc = 1; /* just a point */
+ else if (ps->y2 == ps->y1)
+ xc = (ps->x1 < ps->x2) ? 1 : -1; /* advance x only */
+ else if (ps->x2 == ps->x1)
+ yc = (ps->y1 < ps->y2) ? 1 : -1; /* advance y only */
+ else
+ {
+ xc = (ps->x1 < ps->x2) ? 1 : -1;
+ yc = (ps->y1 < ps->y2) ? 1 : -1;
+ }
GDI_CALL (LineTo, (hdc, ps->x2 + xc, ps->y2 + yc));
}
}
+ if (x_offset != 0 || y_offset != 0)
+ g_free (segs);
}
static void
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 958df71c9..ae67429e6 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1041,11 +1041,16 @@ show_window_internal (GdkWindow *window,
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
if (raise)
- if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
- SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- else
- BringWindowToTop (GDK_WINDOW_HWND (window));
+ {
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
+ SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL
+ || GDK_WINDOW_TYPE (window) == GDK_WINDOW_DIALOG)
+ SetForegroundWindow (GDK_WINDOW_HWND (window));
+ else
+ BringWindowToTop (GDK_WINDOW_HWND (window));
+ }
else if (old_active_window != GDK_WINDOW_HWND (window))
SetActiveWindow (old_active_window);
}