gtk/gdk/win32/gdkprivate-win32.h

493 lines
13 KiB
C
Raw Normal View History

/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
1999-11-17 00:45:37 +00:00
#ifndef __GDK_PRIVATE_WIN32_H__
#define __GDK_PRIVATE_WIN32_H__
1999-11-17 00:45:37 +00:00
#include <gdk/gdkprivate.h>
#include <gdk/win32/gdkwindow-win32.h>
#include <gdk/win32/gdkpixmap-win32.h>
#include "gdkinternals.h"
#include <config.h>
/* Make up for some minor w32api header lossage */
/* PS_JOIN_MASK is missing */
#ifndef PS_JOIN_MASK
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
#endif
/* CLR_INVALID is missing */
#ifndef CLR_INVALID
#define CLR_INVALID CLR_NONE
#endif
/* Some charsets are missing from MSVC 5 headers */
#ifndef JOHAB_CHARSET
#define JOHAB_CHARSET 130
#endif
#ifndef VIETNAMESE_CHARSET
#define VIETNAMESE_CHARSET 163
#endif
#ifndef FS_VIETNAMESE
#define FS_VIETNAMESE 0x100
#endif
/* Some virtual keycodes are missing */
#ifndef VM_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#ifndef VK_OEM_COMMA
#define VK_OEM_COMMA 0xBC
#endif
#ifndef VK_OEM_MINUS
#define VK_OEM_MINUS 0xBD
#endif
#ifndef VK_OEM_PERIOD
#define VK_OEM_PERIOD 0xBE
#endif
#ifndef VK_OEM_1
#define VK_OEM_1 0xBA
#endif
#ifndef VK_OEM_2
#define VK_OEM_2 0xBF
#endif
#ifndef VK_OEM_3
#define VK_OEM_3 0xC0
#endif
#ifndef VK_OEM_4
#define VK_OEM_4 0xDB
#endif
#ifndef VK_OEM_5
#define VK_OEM_5 0xDC
#endif
#ifndef VK_OEM_6
#define VK_OEM_6 0xDD
#endif
#ifndef VK_OEM_7
#define VK_OEM_7 0xDE
#endif
#ifndef VK_OEM_8
#define VK_OEM_8 0xDF
#endif
/* Missing messages */
#ifndef WM_SYNCPAINT
#define WM_SYNCPAINT 0x88
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0X20A
#endif
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x3D
#endif
#ifndef WM_NCXBUTTONDOWN
#define WM_NCXBUTTONDOWN 0xAB
#endif
#ifndef WM_NCXBUTTONUP
#define WM_NCXBUTTONUP 0xAC
#endif
#ifndef WM_NCXBUTTONDBLCLK
#define WM_NCXBUTTONDBLCLK 0xAD
#endif
#ifndef WM_MENURBUTTONUP
#define WM_MENURBUTTONUP 0x122
#endif
#ifndef WM_MENUDRAG
#define WM_MENUDRAG 0x123
#endif
#ifndef WM_MENUGETOBJECT
#define WM_MENUGETOBJECT 0x124
#endif
#ifndef WM_UNINITMENUPOPUP
#define WM_UNINITMENUPOPUP 0x125
#endif
#ifndef WM_MENUCOMMAND
#define WM_MENUCOMMAND 0x126
#endif
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x127
#endif
#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x128
#endif
#ifndef WM_QUERYUISTATE
#define WM_QUERYUISTATE 0x129
#endif
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x20B
#endif
#ifndef WM_XBUTTONUP
#define WM_XBUTTONUP 0x20C
#endif
#ifndef WM_XBUTTONDBLCLK
#define WM_XBUTTONDBLCLK 0x20D
#endif
#ifndef WM_IME_REQUEST
#define WM_IME_REQUEST 0x288
#endif
#ifndef WM_MOUSEHOVER
#define WM_MOUSEHOVER 0x2A1
#endif
#ifndef WM_MOUSELEAVE
#define WM_MOUSELEAVE 0x2A3
#endif
#ifndef WM_NCMOUSEHOVER
#define WM_NCMOUSEHOVER 0x2A0
#endif
#ifndef WM_NCMOUSELEAVE
#define WM_NCMOUSELEAVE 0x2A2
#endif
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x319
#endif
#ifndef WM_HANDHELDFIRST
#define WM_HANDHELDFIRST 0x358
#endif
#ifndef WM_HANDHELDLAST
#define WM_HANDHELDLAST 0x35F
#endif
#ifndef WM_AFXFIRST
#define WM_AFXFIRST 0x360
#endif
#ifndef WM_AFXLAST
#define WM_AFXLAST 0x37F
#endif
#ifndef CopyCursor
#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
#endif
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
/* Define some combinations of GdkDebugFlags */
#define GDK_DEBUG_EVENTS_OR_COLORMAP (GDK_DEBUG_EVENTS|GDK_DEBUG_COLORMAP)
#define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT)
#define GDK_DEBUG_PIXMAP_OR_COLORMAP (GDK_DEBUG_PIXMAP|GDK_DEBUG_COLORMAP)
#define GDK_DEBUG_MISC_OR_COLORMAP (GDK_DEBUG_MISC|GDK_DEBUG_COLORMAP)
#define GDK_TYPE_GC_WIN32 (_gdk_gc_win32_get_type ())
#define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
#define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
#define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
typedef struct _GdkGCWin32 GdkGCWin32;
typedef struct _GdkGCWin32Class GdkGCWin32Class;
struct _GdkCursorPrivate
{
GdkCursor cursor;
HCURSOR hcursor;
};
struct _GdkWin32SingleFont
{
HFONT hfont;
UINT charset;
UINT codepage;
FONTSIGNATURE fs;
};
struct _GdkFontPrivateWin32
{
GdkFontPrivate base;
GSList *fonts; /* List of GdkWin32SingleFonts */
GSList *names;
};
struct _GdkVisualClass
{
GObjectClass parent_class;
};
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
typedef enum {
GDK_WIN32_PE_STATIC,
GDK_WIN32_PE_AVAILABLE,
GDK_WIN32_PE_INUSE
} GdkWin32PalEntryState;
struct _GdkColormapPrivateWin32
{
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
HPALETTE hpal;
gint current_size; /* Current size of hpal */
GdkWin32PalEntryState *use;
gint private_val;
GHashTable *hash;
GdkColorInfo *info;
};
struct _GdkGCWin32
{
GdkGC parent_instance;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HDC hdc;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
int saved_dc;
GdkRegion *clip_region;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gulong foreground; /* Pixel values from GdkColor, */
gulong background; /* not Win32 COLORREFs */
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
DWORD *pen_dashes; /* use for PS_USERSTYLE or step-by-step rendering */
gint pen_num_dashes;
HANDLE hwnd; /* If a HDC is allocated, for which window,
* or what bitmap is selected into it
*/
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
HPALETTE holdpal;
};
struct _GdkGCWin32Class
{
GdkGCClass parent_class;
};
GType _gdk_gc_win32_get_type (void);
/* Routines from gdkgeometry-win32.c */
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
void _gdk_window_init_position (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
/* gdkdrawable-win32.c, background draw helper */
void _gdk_win32_draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *tile,
gint x,
gint y,
gint width,
gint height);
void _gdk_win32_selection_init (void);
void _gdk_win32_dnd_exit (void);
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
void gdk_win32_handle_table_insert (HANDLE *handle,
gpointer data);
void gdk_win32_handle_table_remove (HANDLE handle);
GdkGC *_gdk_win32_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
GdkImage *_gdk_win32_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
GdkImage *_gdk_win32_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height);
GdkPixmap *_gdk_win32_pixmap_new (GdkWindow *window,
GdkVisual *visual,
gint width,
gint height,
gint depth);
GdkImage *_gdk_win32_setup_pixmap_image (GdkPixmap *pixmap,
GdkWindow *window,
gint width,
gint height,
gint depth,
guchar *bits);
void _gdk_win32_blit (gboolean use_fg_bg,
GdkDrawableImplWin32 *drawable,
GdkGC *gc,
GdkDrawable *src,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
gulong pixel);
HRGN _gdk_win32_bitmap_to_region (GdkPixmap *bitmap);
gchar *gdk_font_full_name_get (GdkFont *font);
Large changes to the Win32 backend, partially made necessary by the 2000-05-02 Tor Lillqvist <tml@iki.fi> Large changes to the Win32 backend, partially made necessary by the changes to the backend-independent internal structures. Attempts to implement similar backing store stuff as on X11. The current (CVS) version of the Win32 backend is *not* as stable as it was before the no-flicker branch was merged. A zipfile with that version is available from http://www.gimp.org/win32/. That should be use by "production" code until this CVS version is usable. (But note, the Win32 backend has never been claimed to be "production quality".) * README.win32: Add the above comment about versions. * gdk/gdkwindow.c: Don't use backing store for now on Win32. * gdk/gdk.def: Update. * gdk/gdkfont.h: Declare temporary Win32-only functions. Will presumably be replaced by some more better mechanism as 1.4 gets closer to release shape. * gdk/makefile.{cygwin,msc}: Update. * gdk/win32/*.c: Correct inclusions of the backend-specific and internal headers. Change code according to changes in these. Use gdk_drawable_*, not gdk_window_* where necessary. * gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not our old DND. * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try to interpret single characters as UTF-8. Thanks to Hans Breuer. Use correct function name in warning messages. * gdk/win32/gdkevents-win32.c: Use correct parameter lists for the GSourceFuncs gdk_event_prepare and gdk_event_check. (gdk_event_get_graphics_expose): Do implement, use PeekMessage. Thanks to Hans Breuer. (event_mask_string): Debugging function to print an GdkEventMask. (gdk_pointer_grab): Use it. * gdk/win32/gdkfont-win32.c: The Unicode subrange that the (old) book I used claimed was Hangul actually is CJK Unified Ideographs Extension A. Also, Hangul Syllables were missing. Improve logging. * gdk/win32/gdkgc-win32.c: Largish changes. * gdk/win32/gdkim-win32.c (gdk_set_locale): Use g_win32_getlocale() from GLib, and not setlocale() to get current locale name. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to gdkwin32.h, similarily as in the X11 backend. * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix, assignment was used instead of equals in if test. Thanks to Hans Breuer. * gdk/win32/makefile.{cygwin,msc} * gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the path to the Win32 headers that works also with the mingw compiler. * gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
void _gdk_selection_property_store (GdkWindow *owner,
GdkAtom type,
gint format,
guchar *data,
gint length);
void _gdk_selection_property_delete (GdkWindow *);
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
void _gdk_dropfiles_store (gchar *data);
gint _gdk_utf8_to_ucs2 (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max);
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
gchar *_gdk_ucs2_to_utf8 (const wchar_t *src,
gint src_len);
void _gdk_wchar_text_handle (GdkFont *font,
const wchar_t *wcstr,
int wclen,
void (*handler)(GdkWin32SingleFont *,
const wchar_t *,
int,
void *),
void *arg);
1999-11-17 00:45:37 +00:00
#ifdef G_ENABLE_DEBUG
gchar *gdk_win32_color_to_string (const GdkColor *color);
gchar *gdk_win32_cap_style_to_string (GdkCapStyle cap_style);
gchar *gdk_win32_fill_style_to_string (GdkFill fill);
gchar *gdk_win32_function_to_string (GdkFunction function);
gchar *gdk_win32_join_style_to_string (GdkJoinStyle join_style);
gchar *gdk_win32_line_style_to_string (GdkLineStyle line_style);
gchar *gdk_win32_message_name (UINT msg);
#define PING() printf(G_STRLOC),fflush(stdout)
#else
#define PING()
#endif
Large changes to the Win32 backend, partially made necessary by the 2000-05-02 Tor Lillqvist <tml@iki.fi> Large changes to the Win32 backend, partially made necessary by the changes to the backend-independent internal structures. Attempts to implement similar backing store stuff as on X11. The current (CVS) version of the Win32 backend is *not* as stable as it was before the no-flicker branch was merged. A zipfile with that version is available from http://www.gimp.org/win32/. That should be use by "production" code until this CVS version is usable. (But note, the Win32 backend has never been claimed to be "production quality".) * README.win32: Add the above comment about versions. * gdk/gdkwindow.c: Don't use backing store for now on Win32. * gdk/gdk.def: Update. * gdk/gdkfont.h: Declare temporary Win32-only functions. Will presumably be replaced by some more better mechanism as 1.4 gets closer to release shape. * gdk/makefile.{cygwin,msc}: Update. * gdk/win32/*.c: Correct inclusions of the backend-specific and internal headers. Change code according to changes in these. Use gdk_drawable_*, not gdk_window_* where necessary. * gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not our old DND. * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try to interpret single characters as UTF-8. Thanks to Hans Breuer. Use correct function name in warning messages. * gdk/win32/gdkevents-win32.c: Use correct parameter lists for the GSourceFuncs gdk_event_prepare and gdk_event_check. (gdk_event_get_graphics_expose): Do implement, use PeekMessage. Thanks to Hans Breuer. (event_mask_string): Debugging function to print an GdkEventMask. (gdk_pointer_grab): Use it. * gdk/win32/gdkfont-win32.c: The Unicode subrange that the (old) book I used claimed was Hangul actually is CJK Unified Ideographs Extension A. Also, Hangul Syllables were missing. Improve logging. * gdk/win32/gdkgc-win32.c: Largish changes. * gdk/win32/gdkim-win32.c (gdk_set_locale): Use g_win32_getlocale() from GLib, and not setlocale() to get current locale name. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to gdkwin32.h, similarily as in the X11 backend. * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix, assignment was used instead of equals in if test. Thanks to Hans Breuer. * gdk/win32/makefile.{cygwin,msc} * gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the path to the Win32 headers that works also with the mingw compiler. * gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
gchar *gdk_win32_last_error_string (void);
void gdk_win32_api_failed (const gchar *where,
gint line,
const gchar *api);
void gdk_other_api_failed (const gchar *where,
gint line,
const gchar *api);
void gdk_win32_gdi_failed (const gchar *where,
gint line,
const gchar *api);
Large changes to the Win32 backend, partially made necessary by the 2000-05-02 Tor Lillqvist <tml@iki.fi> Large changes to the Win32 backend, partially made necessary by the changes to the backend-independent internal structures. Attempts to implement similar backing store stuff as on X11. The current (CVS) version of the Win32 backend is *not* as stable as it was before the no-flicker branch was merged. A zipfile with that version is available from http://www.gimp.org/win32/. That should be use by "production" code until this CVS version is usable. (But note, the Win32 backend has never been claimed to be "production quality".) * README.win32: Add the above comment about versions. * gdk/gdkwindow.c: Don't use backing store for now on Win32. * gdk/gdk.def: Update. * gdk/gdkfont.h: Declare temporary Win32-only functions. Will presumably be replaced by some more better mechanism as 1.4 gets closer to release shape. * gdk/makefile.{cygwin,msc}: Update. * gdk/win32/*.c: Correct inclusions of the backend-specific and internal headers. Change code according to changes in these. Use gdk_drawable_*, not gdk_window_* where necessary. * gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not our old DND. * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try to interpret single characters as UTF-8. Thanks to Hans Breuer. Use correct function name in warning messages. * gdk/win32/gdkevents-win32.c: Use correct parameter lists for the GSourceFuncs gdk_event_prepare and gdk_event_check. (gdk_event_get_graphics_expose): Do implement, use PeekMessage. Thanks to Hans Breuer. (event_mask_string): Debugging function to print an GdkEventMask. (gdk_pointer_grab): Use it. * gdk/win32/gdkfont-win32.c: The Unicode subrange that the (old) book I used claimed was Hangul actually is CJK Unified Ideographs Extension A. Also, Hangul Syllables were missing. Improve logging. * gdk/win32/gdkgc-win32.c: Largish changes. * gdk/win32/gdkim-win32.c (gdk_set_locale): Use g_win32_getlocale() from GLib, and not setlocale() to get current locale name. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to gdkwin32.h, similarily as in the X11 backend. * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix, assignment was used instead of equals in if test. Thanks to Hans Breuer. * gdk/win32/makefile.{cygwin,msc} * gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the path to the Win32 headers that works also with the mingw compiler. * gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
#ifdef __GNUC__
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#else
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__, __LINE__, api)
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
#endif
extern LRESULT CALLBACK _gdk_win32_window_procedure (HWND, UINT, WPARAM, LPARAM);
1999-11-17 00:45:37 +00:00
extern HWND gdk_root_window;
Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com> Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings.
2002-06-06 00:26:42 +00:00
extern GdkWindow *_gdk_parent_root;
extern HDC gdk_display_hdc;
extern HINSTANCE gdk_dll_hinstance;
extern HINSTANCE gdk_app_hmodule;
Implement the functions that until now just were non-functional stubs. For 2002-02-26 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkkeys-win32.c: Implement the functions that until now just were non-functional stubs. For "hardware keycodes", we use Windows virtual keycodes. Not scancodes, although that at first might seem more low-level and a better match to X11 keycodes. The Windows API is really mixed up and confused with respect to scancodes and virtual keycodes. (Surprised?) Some scancodes are generated by two keys on the keyboard (!), and although the keyboard messages do have a flag to indicate which key the user pressed, other API that take a scan code as input don't let you specify which actual key you mean. (update_keymap): Function to build a X11-like representation of the keyboard. Each key has four keysyms: two levels (nonshifted and shifted) and two groups (normal and with AltGr). (gdk_keymap_get_direction): Use the codepage corresponding to the thread's input locale, not the system codepage. * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwindow-win32.h * gdk/win32/gdkwindow-win32.c: Remove the input_locale and charset_info fields from GdkWindowImplWin32. Input locale is per-thread in Windows, and as GDK on Windows really only works when the GDI interaction all happens in just one thread anyway, this state can be global. Use globals _gdk_input_locale and _gdk_input_codepage instead. Set these based on the thread's input locale (keyboard layout, or which IME is active). * gdk/win32/gdkevents-win32.c: Set the group and hardware_keycode fields in GDK key events. On input locale change messages, set the global state variables, and inform update_keymap() that it has to rebuild the keymap.
2002-02-26 01:18:27 +00:00
/* These are thread specific, but GDK/win32 works OK only when invoked
* from a single thread anyway.
*/
extern HKL _gdk_input_locale;
extern UINT _gdk_input_codepage;
extern guint _gdk_keymap_serial;
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
/* Registered clipboard formats */
extern WORD cf_rtf;
extern WORD cf_utf8_string;
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
/* GdkAtoms: Targets */
extern GdkAtom utf8_string;
extern GdkAtom compound_text;
extern GdkAtom text_uri_list;
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
/* DND selections */
extern GdkAtom local_dnd;
extern GdkAtom gdk_win32_dropfiles;
extern GdkAtom gdk_ole2_dnd;
extern GdkAtom _gdk_selection_property;
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
extern DWORD windows_version;
#define IS_WIN_NT() (windows_version < 0x80000000)
/* Options */
extern gboolean gdk_input_ignore_wintab;
extern gboolean gdk_event_func_from_window_proc;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
extern gint gdk_max_colors;
Apply the same fixes and improvements as to the gtk-1-3-win32-production 2002-01-10 Tor Lillqvist <tml@iki.fi> Apply the same fixes and improvements as to the gtk-1-3-win32-production branch: Bug fixes and cleanup of selection and DND functionality. Still doesn't work as well as the win32-production branch, though, but getting closer. After this, need to add Archaeopteryx Software's OLE2 DND support. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set, gdk_selection_send_notify, generate_selection_notify): Don't use SendMessage() to generate events for the same app, instead use gdk_event_put(). * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c * gdk/win32/gdkmain-win32.c * gdk/win32/gdkevents-win32.c: Thus, remove declaration, definition, initialisation and handling of gdk_selection_notify_msg, gdk_selection_request_msg and gdk_selection_clear_msg. * gdk/win32/gdkselection-win32.c (gdk_text_property_to_text_list, gdk_free_text_list, gdk_string_to_compound_text, gdk_free_compound_text): Implement trivially, witrh a text_list always having a single element, and a compound text always consisting of just a single (UTF-8!) string. Let's see how well this works. * gdk/win32/gdkselection-win32.c (gdk_selection_convert): Fix non-ASCII paste from the clipboard: Try getting the same formats from the Windows clipboard that gdk_property_change() puts there: CF_UNICODETEXT, UTF8_STRING or CF_TEXT+CF_LOCALE. * gdk/win32/gdkproperty-win32.c (gdk_property_change): When storing text on the clipboard, handle non-ASCII text correctly. The logic is as follows: If we have only ASCII characters, use CF_TEXT. Else, if we are on NT, use CF_UNICODETEXT. Else (we are on Win9x), if all the characters are present in the code page of some installed locale, use CF_TEXT and also set CF_LOCALE to that locale. Else (still on Win9x) store as RTF. We use a very simple RTF string, just the text, no fonts or other crap, with the non-ASCII characters as Unicode \uN keywords. Additionally, also store the UTF-8 string as such, under the format "UTF8_STRING", so that GDK can also paste from the Clipboard what it has copied there. (Thus no need to implement any RTF parser.) (find_common_locale): New function, implements the search for a locale for case 3 above. * gdk/win32/gdkglobals-win32.c: New global variables compound_text, text_uri_list, utf8_string, cf_rtf and cf_utf8_string. * gdk/win32/gdkim-win32.c (_gdk_ucs2_to_utf8): New function, converts from a wchar_t string to UTF-8. (_gdk_utf8_to_ucs2): Rename from _gdk_win32_nmbstowchar_ts. (_gdk_utf8_to_wcs): Rename from gdk_nmbstowchar_ts. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use _gdk_ucs2_to_utf8(). * gdk/win32/gdkselection-win32.c: Remove some unnecessary logging. * gdk/win32/gdkdnd-win32.c: Plug memory leaks, the gdk_drag_context_ref() was called unnecessarily in a couple of places, meaning drag contexts were never freed. The same memory leaks seem to be present in gdk/linux-fb/gdkselection-fb.c, BTW. (gdk_drop_reply): For WIN32_DROPFILES drops, free the temporarily stored file list. * gdk/win32/gdkselection-win32.c: Clarify the use of the sel_prop_table. Now it is used only for storing the GDK_SELECTION "properties". The file names dropped with WM_DROPFILES -style DND is stored temporarily (between the drop and the target picking them up) in a separate place. Have a separate hash table to map selection atoms to owner windows. This used to be quite mixed up. (_gdk_dropfiles_store): New function, to store the dropped file list for the drop target to possibly fetch, and clear it afterwards, from gdk_drop_reply(). (gdk_selection_owner_get): Much simplified now.
2002-01-10 00:53:39 +00:00
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
#define GDK_WIN32_COLORMAP_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data)
Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com> Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings.
2002-06-06 00:26:42 +00:00
/* Initialization */
void _gdk_windowing_window_init (void);
void _gdk_visual_init (void);
void _gdk_dnd_init (void);
void _gdk_windowing_image_init (void);
void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display);
Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com> Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings.
2002-06-06 00:26:42 +00:00
1999-11-17 00:45:37 +00:00
#endif /* __GDK_PRIVATE_WIN32_H__ */