2003-08-07 Tor Lillqvist <tml@iki.fi

* gdk/gdk.def
	* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
	missing function, trivially implement.

	Merge from HEAD: 2003-08-06  Hans Breuer <hans@breuer.org>

	* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
	initialize bits to 0 (probably default on NT)

	* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
	set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435

	* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
	(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN

	* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
	against all expectations it is basically ony a call with WM_SETICON
	needed (the visual effect is there, though colors or mask are
	still somewhat wrong).

	* gdk/win32/gdkwindow-win32.h : place to store the HICON

	* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
	pixel drawing as it was fixed at 1999-08-23
This commit is contained in:
Tor Lillqvist
2003-08-07 03:35:23 +00:00
parent 4e5aa197dd
commit b6759d3c65
11 changed files with 341 additions and 8 deletions

View File

@@ -1,3 +1,30 @@
2003-08-07 Tor Lillqvist <tml@iki.fi
* gdk/gdk.def
* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
missing function, trivially implement.
Merge from HEAD: 2003-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
initialize bits to 0 (probably default on NT)
* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435
* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN
* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
against all expectations it is basically ony a call with WM_SETICON
needed (the visual effect is there, though colors or mask are
still somewhat wrong).
* gdk/win32/gdkwindow-win32.h : place to store the HICON
* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
pixel drawing as it was fixed at 1999-08-23
2003-08-07 Matthias Clasen <maclas@gmx.de>
* gtk/gtkctree.c (draw_row): Don't cut descenders when rendering. (#118646, Charles Kerr)

View File

@@ -1,3 +1,30 @@
2003-08-07 Tor Lillqvist <tml@iki.fi
* gdk/gdk.def
* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
missing function, trivially implement.
Merge from HEAD: 2003-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
initialize bits to 0 (probably default on NT)
* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435
* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN
* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
against all expectations it is basically ony a call with WM_SETICON
needed (the visual effect is there, though colors or mask are
still somewhat wrong).
* gdk/win32/gdkwindow-win32.h : place to store the HICON
* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
pixel drawing as it was fixed at 1999-08-23
2003-08-07 Matthias Clasen <maclas@gmx.de>
* gtk/gtkctree.c (draw_row): Don't cut descenders when rendering. (#118646, Charles Kerr)

View File

@@ -1,3 +1,30 @@
2003-08-07 Tor Lillqvist <tml@iki.fi
* gdk/gdk.def
* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
missing function, trivially implement.
Merge from HEAD: 2003-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
initialize bits to 0 (probably default on NT)
* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435
* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN
* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
against all expectations it is basically ony a call with WM_SETICON
needed (the visual effect is there, though colors or mask are
still somewhat wrong).
* gdk/win32/gdkwindow-win32.h : place to store the HICON
* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
pixel drawing as it was fixed at 1999-08-23
2003-08-07 Matthias Clasen <maclas@gmx.de>
* gtk/gtkctree.c (draw_row): Don't cut descenders when rendering. (#118646, Charles Kerr)

View File

@@ -1,3 +1,30 @@
2003-08-07 Tor Lillqvist <tml@iki.fi
* gdk/gdk.def
* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
missing function, trivially implement.
Merge from HEAD: 2003-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
initialize bits to 0 (probably default on NT)
* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435
* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN
* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
against all expectations it is basically ony a call with WM_SETICON
needed (the visual effect is there, though colors or mask are
still somewhat wrong).
* gdk/win32/gdkwindow-win32.h : place to store the HICON
* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
pixel drawing as it was fixed at 1999-08-23
2003-08-07 Matthias Clasen <maclas@gmx.de>
* gtk/gtkctree.c (draw_row): Don't cut descenders when rendering. (#118646, Charles Kerr)

View File

@@ -1,3 +1,30 @@
2003-08-07 Tor Lillqvist <tml@iki.fi
* gdk/gdk.def
* gdk/win32/gdkfont-win32.c (gdk_fontset_load_for_display): Add
missing function, trivially implement.
Merge from HEAD: 2003-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) :
initialize bits to 0 (probably default on NT)
* gdk/win32/gdkwindow-win32.c(gdk_window_set_modal_hint) :
set HWND_NOTOPMOST for modal==FALSE, fixes bug #118435
* gdk/win32/gdkwindow-win32.c : implement gdk_window_[un]fullscreen
(gdk_window_{move,resize,move_rezize})) : noop if FULLSCREEN
* gdk/win32/gdkwindow-win32.c (gdk_window_set_icon) :
against all expectations it is basically ony a call with WM_SETICON
needed (the visual effect is there, though colors or mask are
still somewhat wrong).
* gdk/win32/gdkwindow-win32.h : place to store the HICON
* gdk/win32/gdkdrawabke.win32.c : readded the conditional end
pixel drawing as it was fixed at 1999-08-23
2003-08-07 Matthias Clasen <maclas@gmx.de>
* gtk/gtkctree.c (draw_row): Don't cut descenders when rendering. (#118646, Charles Kerr)

View File

@@ -186,6 +186,7 @@ EXPORTS
gdk_font_type_get_type
gdk_font_unref
gdk_fontset_load
gdk_fontset_load_for_display
gdk_free_compound_text
gdk_free_text_list
gdk_function_get_type

View File

@@ -1226,6 +1226,23 @@ draw_segments (GdkGCWin32 *gcwin32,
for (i = 0; i < nsegs; i++)
GDI_CALL (MoveToEx, (hdc, segs[i].x1, segs[i].y1, NULL)) &&
GDI_CALL (LineTo, (hdc, segs[i].x2, segs[i].y2));
/* not drawing the end pixel does produce a crippled mask, look
* 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
*/
if (gcwin32->pen_width <= 1 && !IS_WIN_NT ())
{
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;
GDI_CALL (LineTo, (hdc, ps->x2 + xc, ps->y2 + yc));
}
}
}

View File

@@ -1334,6 +1334,15 @@ gdk_fontset_load (const gchar *fontset_name)
return font;
}
GdkFont*
gdk_fontset_load_for_display (GdkDisplay *display,
const gchar *fontset_name)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gdk_fontset_load (fontset_name);
}
void
_gdk_font_destroy (GdkFont *font)
{

View File

@@ -303,6 +303,11 @@ gdk_pixmap_new (GdkDrawable *drawable,
}
drawable_impl->handle = hbitmap;
/* Initialize to zero on Win9x*/
if (!IS_WIN_NT ())
memset (bits, 0, (bmi.bmiHeader.biBitCount * width * height) / 8);
pixmap_impl->bits = bits;
gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap);

View File

@@ -35,6 +35,11 @@
#include "gdkprivate-win32.h"
#include "gdkinput-win32.h"
#if 0
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <stdio.h>
#endif
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
GdkColormap *cmap);
@@ -89,6 +94,7 @@ gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
impl->height = 1;
impl->hcursor = NULL;
impl->hicon = NULL;
impl->hint_flags = 0;
impl->extension_events_selected = FALSE;
}
@@ -138,6 +144,11 @@ gdk_window_impl_win32_finalize (GObject *object)
GDI_CALL (DestroyCursor, (window_impl->hcursor));
window_impl->hcursor = NULL;
}
if (window_impl->hicon != NULL)
{
GDI_CALL (DestroyIcon, (window_impl->hicon));
window_impl->hicon = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -930,7 +941,9 @@ show_window_internal (GdkWindow *window,
old_active_window = GetActiveWindow ();
if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
gdk_window_fullscreen (window);
else if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
@@ -1038,6 +1051,9 @@ gdk_window_move (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
return;
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, x, y, impl->width, impl->height);
else
@@ -1078,6 +1094,9 @@ gdk_window_resize (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
return;
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, private->x, private->y, width, height);
else
@@ -1117,6 +1136,9 @@ gdk_window_move_resize (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
return;
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %p: %dx%d@+%d+%d\n",
GDK_WINDOW_HWND (window),
width, height, x, y));
@@ -2155,16 +2177,99 @@ gdk_window_set_icon (GdkWindow *window,
GdkPixmap *pixmap,
GdkBitmap *mask)
{
ICONINFO ii;
HICON hIcon;
gint w = 0, h = 0;
GdkWindowImplWin32 *impl;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
/* Nothing to do, really. As we share window classes between windows
* we can't have window-specific icons, sorry. Don't print any warning
* either.
*/
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
if (pixmap)
{
HBITMAP hbmmask = NULL;
gdk_drawable_get_size (GDK_DRAWABLE(pixmap), &w, &h);
/* we need the inverted mask for the XOR op */
{
HDC hdc1 = CreateCompatibleDC (NULL);
HBITMAP hbmold1;
hbmmask = CreateCompatibleBitmap (hdc1, w, h);
hbmold1 = SelectObject (hdc1, hbmmask);
if (mask)
{
HDC hdc2 = CreateCompatibleDC (NULL);
HBITMAP hbmold2 = SelectObject (hdc2, GDK_PIXMAP_HBITMAP (mask));
GDI_CALL (BitBlt, (hdc1, 0,0,w,h, hdc2, 0,0, NOTSRCCOPY));
GDI_CALL (SelectObject, (hdc2, hbmold2));
GDI_CALL (DeleteDC, (hdc2));
}
else
{
RECT rect;
GetClipBox (hdc1, &rect);
GDI_CALL (FillRect, (hdc1, &rect, GetStockObject (WHITE_BRUSH)));
}
GDI_CALL (SelectObject, (hdc1, hbmold1));
GDI_CALL (DeleteDC, (hdc1));
}
ii.fIcon = TRUE;
ii.xHotspot = ii.yHotspot = 0; /* ignored for icons */
ii.hbmMask = hbmmask;
ii.hbmColor = GDK_PIXMAP_HBITMAP (pixmap);
hIcon = CreateIconIndirect (&ii);
if (!hIcon)
WIN32_API_FAILED ("CreateIconIndirect");
GDI_CALL (DeleteObject, (hbmmask));
#if 0 /* to debug pixmap and mask setting */
{
static int num = 0;
GdkPixbuf* pixbuf = NULL;
char name[256];
pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, NULL, 0, 0, 0, 0, w, h);
if (pixbuf)
{
num = (num + 1) % 999; /* restrict maximim number */
sprintf (name, "c:\\temp\\ico%03dpixm.png", num);
gdk_pixbuf_save (pixbuf, name, "png", NULL, NULL);
gdk_pixbuf_unref (pixbuf);
}
pixbuf = !mask ? NULL : gdk_pixbuf_get_from_drawable (NULL, mask, NULL, 0, 0, 0, 0, w, h);
if (pixbuf)
{
sprintf (name, "c:\\temp\\ico%03dmask.png", num);
gdk_pixbuf_save (pixbuf, name, "png", NULL, NULL);
gdk_pixbuf_unref (pixbuf);
}
}
#endif
hIcon = (HICON)SendMessage (GDK_WINDOW_HWND (window), WM_SETICON, ICON_BIG, (LPARAM)hIcon);
if (impl->hicon)
GDI_CALL (DestroyIcon, (impl->hicon));
impl->hicon = hIcon;
}
else
{
/* reseting to default icon */
if (impl->hicon)
{
hIcon = (HICON)SendMessage (GDK_WINDOW_HWND (window), WM_SETICON, ICON_BIG, 0);
GDI_CALL (DestroyIcon, (impl->hicon));
impl->hicon = NULL;
}
}
GDK_NOTE (MISC, g_print ("gdk_window_set_icon : %p %dx%d\n", hIcon, w, h));
}
void
@@ -2547,18 +2652,77 @@ gdk_window_unmaximize (GdkWindow *window)
0);
}
typedef struct _FullscreenInfo FullscreenInfo;
struct _FullscreenInfo
{
RECT r;
guint hint_flags;
LONG style;
};
void
gdk_window_fullscreen (GdkWindow *window)
{
gint width, height;
FullscreenInfo *fi;
GdkWindowObject *private = (GdkWindowObject *) window;
g_return_if_fail (GDK_IS_WINDOW (window));
g_warning ("gdk_window_fullscreen() not implemented.\n");
width = GetSystemMetrics (SM_CXSCREEN);
height = GetSystemMetrics (SM_CYSCREEN);
fi = g_new (FullscreenInfo, 1);
if (!GetWindowRect (GDK_WINDOW_HWND (window), &(fi->r)))
g_free (fi);
else
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
/* remember for restoring */
fi->hint_flags = impl->hint_flags;
impl->hint_flags &= ~GDK_HINT_MAX_SIZE;
g_object_set_data (G_OBJECT (window), "fullscreen-info", fi);
fi->style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
(fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
if (!SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP /*not MOST, taskswitch!*/,
0, 0, width, height,
SWP_NOCOPYBITS | SWP_SHOWWINDOW))
WIN32_API_FAILED ("SetWindowPos");
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
}
}
void
gdk_window_unfullscreen (GdkWindow *window)
{
FullscreenInfo *fi;
GdkWindowObject *private = (GdkWindowObject *) window;
g_return_if_fail (GDK_IS_WINDOW (window));
fi = g_object_get_data (G_OBJECT(window), "fullscreen-info");
if (fi)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
impl->hint_flags = fi->hint_flags;
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style);
if (!SetWindowPos (GDK_WINDOW_HWND (window), HWND_NOTOPMOST,
fi->r.left, fi->r.top, fi->r.right - fi->r.left, fi->r.bottom - fi->r.top,
SWP_NOCOPYBITS | SWP_SHOWWINDOW))
WIN32_API_FAILED ("SetWindowPos");
g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
g_free (fi);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
}
}
void
@@ -2595,7 +2759,8 @@ gdk_window_set_modal_hint (GdkWindow *window,
private->modal_hint = modal;
if (GDK_WINDOW_IS_MAPPED (window))
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOPMOST,
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
modal ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE));
}

View File

@@ -76,6 +76,7 @@ struct _GdkWindowImplWin32
GdkWin32PositionInfo position_info;
HCURSOR hcursor;
HICON hicon;
/* Window size hints */
gint hint_flags;