forked from AuroraMiddleware/gtk
finally also create the correct mask for 'pseudo mime' icons
2004-05-08 Hans Breuer <hans@breuer.org> * gtk/gtkfilesystemwin32.c (extract_icon) : finally also create the correct mask for 'pseudo mime' icons * gdk/win32/gdkwindow-win32.c(show_window_internal) : also take focus_on_map into account * gtk/gtkselection.c : g_message() only with DEBUG_SELECTION * gtk/gtkactiongroup.c gtk/gtkcombobox.c : ... must return a value * gdk/gdk.def gtk/gtk.def demos/gtk-demo/makefile.msc.in : updated
This commit is contained in:
parent
a4f0cc112b
commit
805abff3cf
@ -39,19 +39,23 @@ DEMOS = \
|
||||
appwindow.c \
|
||||
button_box.c \
|
||||
colorsel.c \
|
||||
dialog.c \
|
||||
dialog.c \
|
||||
drawingarea.c \
|
||||
editable_cells.c \
|
||||
images.c \
|
||||
item_factory.c \
|
||||
editable_cells.c \
|
||||
entry_completion.c \
|
||||
expander.c \
|
||||
hypertext.c \
|
||||
images.c \
|
||||
list_store.c \
|
||||
menus.c \
|
||||
panes.c \
|
||||
pixbufs.c \
|
||||
pixbufs.c \
|
||||
sizegroup.c \
|
||||
stock_browser.c \
|
||||
textview.c \
|
||||
tree_store.c \
|
||||
ui_manager.c \
|
||||
|
||||
|
||||
demos.h: $(DEMOS) geninclude.pl
|
||||
$(PERL) geninclude.pl $(DEMOS) > demos.h
|
||||
@ -59,12 +63,15 @@ demos.h: $(DEMOS) geninclude.pl
|
||||
OBJECTS = \
|
||||
appwindow.obj \
|
||||
button_box.obj \
|
||||
changedisplay.obj \
|
||||
colorsel.obj \
|
||||
dialog.obj \
|
||||
drawingarea.obj \
|
||||
editable_cells.obj \
|
||||
editable_cells.obj \
|
||||
entry_completion.obj \
|
||||
expander.obj \
|
||||
hypertext.obj \
|
||||
images.obj \
|
||||
item_factory.obj \
|
||||
list_store.obj \
|
||||
menus.obj \
|
||||
panes.obj \
|
||||
@ -73,6 +80,7 @@ OBJECTS = \
|
||||
stock_browser.obj \
|
||||
textview.obj \
|
||||
tree_store.obj \
|
||||
ui_manager.obj \
|
||||
main.obj \
|
||||
|
||||
gtk-demo.exe : demos.h $(OBJECTS)
|
||||
|
@ -531,6 +531,7 @@ EXPORTS
|
||||
gdk_window_set_debug_updates
|
||||
gdk_window_set_decorations
|
||||
gdk_window_set_events
|
||||
gdk_window_set_focus_on_map
|
||||
gdk_window_set_functions
|
||||
gdk_window_set_geometry_hints
|
||||
gdk_window_set_group
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
* Copyright (C) 1998-2002 Tor Lillqvist
|
||||
* Copyright (C) 1998-2004 Tor Lillqvist
|
||||
* Copyright (C) 2001-2004 Hans Breuer
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -953,7 +954,8 @@ show_window_internal (GdkWindow *window,
|
||||
{
|
||||
GdkWindowObject *private;
|
||||
HWND old_active_window;
|
||||
|
||||
gboolean focus_on_map = TRUE;
|
||||
|
||||
private = (GdkWindowObject *) window;
|
||||
|
||||
if (private->destroyed)
|
||||
@ -996,9 +998,12 @@ show_window_internal (GdkWindow *window,
|
||||
/* Other cases */
|
||||
|
||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_WITHDRAWN,
|
||||
0);
|
||||
{
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_WITHDRAWN,
|
||||
0);
|
||||
focus_on_map = private->focus_on_map;
|
||||
}
|
||||
|
||||
/* Use SetWindowPos to show transparent windows so automatic redraws
|
||||
* in other windows can be suppressed.
|
||||
@ -1008,7 +1013,7 @@ show_window_internal (GdkWindow *window,
|
||||
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE;
|
||||
if (!raise)
|
||||
flags |= SWP_NOZORDER;
|
||||
if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
|
||||
if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
||||
flags |= SWP_NOACTIVATE;
|
||||
|
||||
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0, flags);
|
||||
@ -1036,7 +1041,7 @@ show_window_internal (GdkWindow *window,
|
||||
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
|
||||
else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
|
||||
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
||||
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
|
||||
else
|
||||
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
|
||||
|
@ -77,6 +77,7 @@ EXPORTS
|
||||
gtk_action_group_set_translate_func
|
||||
gtk_action_group_set_translation_domain
|
||||
gtk_action_group_set_visible
|
||||
gtk_action_group_translate_string
|
||||
gtk_action_is_sensitive
|
||||
gtk_action_is_visible
|
||||
gtk_action_new
|
||||
@ -388,8 +389,11 @@ EXPORTS
|
||||
gtk_combo_box_entry_set_text_column
|
||||
gtk_combo_box_get_active
|
||||
gtk_combo_box_get_active_iter
|
||||
gtk_combo_box_get_column_span_column
|
||||
gtk_combo_box_get_model
|
||||
gtk_combo_box_get_row_span_column
|
||||
gtk_combo_box_get_type
|
||||
gtk_combo_box_get_wrap_width
|
||||
gtk_combo_box_insert_text
|
||||
gtk_combo_box_new
|
||||
gtk_combo_box_new_text
|
||||
@ -2611,6 +2615,7 @@ EXPORTS
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_focus
|
||||
gtk_window_get_focus_on_map
|
||||
gtk_window_get_frame_dimensions
|
||||
gtk_window_get_gravity
|
||||
gtk_window_get_has_frame
|
||||
@ -2660,6 +2665,7 @@ EXPORTS
|
||||
gtk_window_set_default_size
|
||||
gtk_window_set_destroy_with_parent
|
||||
gtk_window_set_focus
|
||||
gtk_window_set_focus_on_map
|
||||
gtk_window_set_frame_dimensions
|
||||
gtk_window_set_geometry_hints
|
||||
gtk_window_set_gravity
|
||||
|
@ -1067,7 +1067,7 @@ gtk_action_group_translate_string (GtkActionGroup *action_group,
|
||||
GtkTranslateFunc translate_func;
|
||||
gpointer translate_data;
|
||||
|
||||
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
||||
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), string);
|
||||
|
||||
translate_func = action_group->private_data->translate_func;
|
||||
translate_data = action_group->private_data->translate_data;
|
||||
|
@ -3468,8 +3468,8 @@ gtk_combo_box_get_active_text (GtkComboBox *combo_box)
|
||||
GtkTreeIter iter;
|
||||
gchar *text = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
|
||||
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model), NULL);
|
||||
|
||||
if (gtk_combo_box_get_active_iter (combo_box, &iter))
|
||||
gtk_tree_model_get (combo_box->priv->model, &iter,
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* gtkfilesystemwin32.c: Default implementation of GtkFileSystem for Windows
|
||||
* Copyright (C) 2003, Red Hat, Inc.
|
||||
* Copyright (C) 2004, Hans Breuer
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -933,53 +934,91 @@ extract_icon (const char* filename)
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
WORD iicon;
|
||||
HICON hicon;
|
||||
char filename_copy[MAX_PATH];
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return NULL;
|
||||
|
||||
hicon = ExtractAssociatedIcon (GetModuleHandle (NULL), filename, &iicon);
|
||||
/* the ugly ExtractAssociatedIcon modifies filename in place - at least on win98 */
|
||||
strcpy(filename_copy, filename);
|
||||
hicon = ExtractAssociatedIcon (GetModuleHandle (NULL), filename_copy, &iicon);
|
||||
if (hicon > (HICON)1)
|
||||
{
|
||||
ICONINFO ii;
|
||||
|
||||
if (GetIconInfo (hicon, &ii))
|
||||
{
|
||||
SIZE size;
|
||||
GdkPixmap *pixmap;
|
||||
GdkGC *gc;
|
||||
HDC hdc;
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER bi;
|
||||
RGBQUAD colors[2];
|
||||
} bmi;
|
||||
HDC hdc;
|
||||
|
||||
if (!GetBitmapDimensionEx (ii.hbmColor, &size))
|
||||
g_warning ("GetBitmapDimensionEx failed.");
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
hdc = CreateCompatibleDC (NULL);
|
||||
|
||||
if (size.cx < 1) size.cx = 32;
|
||||
if (size.cy < 1) size.cy = 32;
|
||||
|
||||
pixmap = gdk_pixmap_new (NULL, size.cx, size.cy,
|
||||
gdk_screen_get_system_visual (gdk_screen_get_default ())->depth);
|
||||
gc = gdk_gc_new (pixmap);
|
||||
hdc = gdk_win32_hdc_get (GDK_DRAWABLE (pixmap), gc, 0);
|
||||
if (GetDIBits (hdc, ii.hbmColor, 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
|
||||
{
|
||||
gchar *pixels, *bits;
|
||||
gint rowstride, x, y, w = bmi.bi.biWidth, h = bmi.bi.biHeight;
|
||||
|
||||
if (!DrawIcon (hdc, 0, 0, hicon))
|
||||
g_warning ("DrawIcon failed");
|
||||
bmi.bi.biBitCount = 24;
|
||||
bmi.bi.biCompression = BI_RGB;
|
||||
bmi.bi.biHeight = -h;
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
|
||||
bits = g_malloc (4 * w * h);
|
||||
|
||||
gdk_win32_hdc_release (GDK_DRAWABLE (pixmap), gc, 0);
|
||||
/* color data */
|
||||
if (!GetDIBits (hdc, ii.hbmColor, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
|
||||
g_warning(G_STRLOC ": Failed to get dibits");
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (
|
||||
NULL, pixmap,
|
||||
gdk_screen_get_system_colormap (gdk_screen_get_default ()),
|
||||
0, 0, 0, 0, size.cx, size.cy);
|
||||
g_object_unref (pixmap);
|
||||
g_object_unref (gc);
|
||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
pixels[2] = bits[(x+y*w) * 3];
|
||||
pixels[1] = bits[(x+y*w) * 3 + 1];
|
||||
pixels[0] = bits[(x+y*w) * 3 + 2];
|
||||
pixels += 4;
|
||||
}
|
||||
pixels += (w * 4 - rowstride);
|
||||
}
|
||||
/* transparency */
|
||||
if (!GetDIBits (hdc, ii.hbmMask, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
|
||||
g_warning(G_STRLOC ": Failed to get dibits");
|
||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
pixels[3] = 255 - bits[(x + y * w) * 3];
|
||||
pixels += 4;
|
||||
}
|
||||
pixels += (w * 4 - rowstride);
|
||||
}
|
||||
|
||||
/* release temporary resources */
|
||||
g_free (bits);
|
||||
if (!DeleteObject (ii.hbmColor) || !DeleteObject (ii.hbmMask))
|
||||
g_warning(G_STRLOC ": Leaking Icon Bitmaps ?");
|
||||
}
|
||||
else
|
||||
g_warning(G_STRLOC ": GetDIBits () failed, %s", g_win32_error_message (GetLastError ()));
|
||||
|
||||
DeleteDC (hdc);
|
||||
}
|
||||
else
|
||||
g_print ("GetIconInfo failed: %s\n", g_win32_error_message (GetLastError ()));
|
||||
g_warning(G_STRLOC ": GetIconInfo failed: %s\n", g_win32_error_message (GetLastError ()));
|
||||
|
||||
if (!DestroyIcon (hicon))
|
||||
g_warning ("DestroyIcon failed");
|
||||
g_warning(G_STRLOC ": DestroyIcon failed");
|
||||
}
|
||||
else
|
||||
g_print ("ExtractAssociatedIcon failed: %s\n", g_win32_error_message (GetLastError ()));
|
||||
g_print ("ExtractAssociatedIcon(%s) failed: %s\n", filename, g_win32_error_message (GetLastError ()));
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
@ -1048,7 +1087,7 @@ gtk_file_system_win32_render_icon (GtkFileSystem *file_system,
|
||||
case DRIVE_CDROM :
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_CDROM);
|
||||
break;
|
||||
case DRIVE_FIXED : /* need a hard disk icon */
|
||||
case DRIVE_FIXED :
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_HARDDISK);
|
||||
break;
|
||||
default :
|
||||
|
@ -1124,9 +1124,11 @@ _gtk_selection_request (GtkWidget *widget,
|
||||
if (initialize)
|
||||
gtk_selection_init ();
|
||||
|
||||
#if defined DEBUG_SELECTION && !defined GDK_WINDOWING_X11
|
||||
g_message ("max request sizes %ld %ld\n",
|
||||
XMaxRequestSize(GDK_DISPLAY_XDISPLAY(display)),
|
||||
XExtendedMaxRequestSize(GDK_DISPLAY_XDISPLAY(display)));
|
||||
#endif
|
||||
selection_max_size = GTK_SELECTION_MAX_SIZE (display);
|
||||
|
||||
/* Check if we own selection */
|
||||
|
Loading…
Reference in New Issue
Block a user