1999-11-11 22:12:27 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
|
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
|
|
|
* Copyright (C) 1998-2002 Tor Lillqvist
|
1999-11-11 22:12:27 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1999-11-11 22:12:27 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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/.
|
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
1999-11-11 22:12:27 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* #define OLE2_DND */
|
|
|
|
|
|
|
|
#define INITGUID
|
|
|
|
|
|
|
|
#include "gdkdnd.h"
|
|
|
|
#include "gdkproperty.h"
|
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
|
|
|
#include "gdkinternals.h"
|
|
|
|
#include "gdkprivate-win32.h"
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
#include <ole2.h>
|
|
|
|
#else
|
|
|
|
#include <objbase.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <shlguid.h>
|
|
|
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
typedef struct _GdkDragContextPrivateWin32 GdkDragContextPrivateWin32;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GDK_DRAG_STATUS_DRAG,
|
|
|
|
GDK_DRAG_STATUS_MOTION_WAIT,
|
|
|
|
GDK_DRAG_STATUS_ACTION_WAIT,
|
|
|
|
GDK_DRAG_STATUS_DROP
|
|
|
|
} GtkDragStatus;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GDK_DRAG_SOURCE,
|
|
|
|
GDK_DRAG_TARGET
|
|
|
|
} GdkDragKind;
|
|
|
|
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
|
|
|
|
#define PRINT_GUID(guid) \
|
|
|
|
g_print ("guid = %.08x-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", \
|
|
|
|
((gulong *) guid)[0], \
|
|
|
|
((gushort *) guid)[2], \
|
|
|
|
((gushort *) guid)[3], \
|
|
|
|
((guchar *) guid)[8], \
|
|
|
|
((guchar *) guid)[9], \
|
|
|
|
((guchar *) guid)[10], \
|
|
|
|
((guchar *) guid)[11], \
|
|
|
|
((guchar *) guid)[12], \
|
|
|
|
((guchar *) guid)[13], \
|
|
|
|
((guchar *) guid)[14], \
|
|
|
|
((guchar *) guid)[15]);
|
|
|
|
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
static FORMATETC *formats;
|
|
|
|
static int nformats;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
#endif /* OLE2_DND */
|
|
|
|
|
|
|
|
/* Structure that holds information about a drag in progress.
|
|
|
|
* this is used on both source and destination sides.
|
|
|
|
*/
|
2000-07-25 20:38:35 +00:00
|
|
|
struct _GdkDragContextPrivateWin32 {
|
1999-11-11 22:12:27 +00:00
|
|
|
guint16 last_x; /* Coordinates from last event */
|
|
|
|
guint16 last_y;
|
2001-08-19 18:34:59 +00:00
|
|
|
HWND dest_xid;
|
|
|
|
guint drag_status; /* Current status of drag */
|
1999-11-11 22:12:27 +00:00
|
|
|
};
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
#define GDK_DRAG_CONTEXT_PRIVATE_DATA(context) ((GdkDragContextPrivateWin32 *) GDK_DRAG_CONTEXT (context)->windowing_data)
|
2000-07-25 20:38:35 +00:00
|
|
|
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
static GdkDragContext *current_dest_drag = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
static void gdk_drag_context_init (GdkDragContext *dragcontext);
|
|
|
|
static void gdk_drag_context_class_init (GdkDragContextClass *klass);
|
|
|
|
static void gdk_drag_context_finalize (GObject *object);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
static gpointer parent_class = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
static GList *contexts;
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
GType
|
|
|
|
gdk_drag_context_get_type (void)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 20:38:35 +00:00
|
|
|
static GType object_type = 0;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
if (!object_type)
|
|
|
|
{
|
|
|
|
static const GTypeInfo object_info =
|
|
|
|
{
|
|
|
|
sizeof (GdkDragContextClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gdk_drag_context_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GdkDragContext),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gdk_drag_context_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
object_type = g_type_register_static (G_TYPE_OBJECT,
|
|
|
|
"GdkDragContext",
|
2000-11-11 18:39:57 +00:00
|
|
|
&object_info, 0);
|
2000-07-25 20:38:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return object_type;
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
static void
|
|
|
|
gdk_drag_context_init (GdkDragContext *dragcontext)
|
|
|
|
{
|
|
|
|
GdkDragContextPrivateWin32 *private = g_new0 (GdkDragContextPrivateWin32, 1);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
dragcontext->windowing_data = private;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
contexts = g_list_prepend (contexts, dragcontext);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
static void
|
|
|
|
gdk_drag_context_class_init (GdkDragContextClass *klass)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 20:38:35 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
object_class->finalize = gdk_drag_context_finalize;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
static void
|
|
|
|
gdk_drag_context_finalize (GObject *object)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 20:38:35 +00:00
|
|
|
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
2004-02-28 13:21:25 +00:00
|
|
|
|
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize\n"));
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
g_list_free (context->targets);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
if (context->source_window)
|
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (context->source_window);
|
2000-07-25 20:38:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->dest_window)
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (context->dest_window);
|
2000-07-25 20:38:35 +00:00
|
|
|
|
|
|
|
contexts = g_list_remove (contexts, context);
|
2000-05-07 19:45:27 +00:00
|
|
|
|
2004-02-28 13:21:25 +00:00
|
|
|
if (context == current_dest_drag)
|
|
|
|
current_dest_drag = NULL;
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
g_free (private);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
/* Drag Contexts */
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
GdkDragContext *
|
|
|
|
gdk_drag_context_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (gdk_drag_context_get_type (), NULL);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
void
|
|
|
|
gdk_drag_context_ref (GdkDragContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2002-09-25 07:23:55 +00:00
|
|
|
g_object_ref (context);
|
2000-07-25 20:38:35 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
void
|
|
|
|
gdk_drag_context_unref (GdkDragContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
|
|
|
|
2002-09-25 07:23:55 +00:00
|
|
|
g_object_unref (context);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GdkDragContext *
|
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
|
|
|
gdk_drag_context_find (gboolean is_source,
|
|
|
|
GdkWindow *source,
|
|
|
|
GdkWindow *dest)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GList *tmp_list = contexts;
|
|
|
|
GdkDragContext *context;
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
context = (GdkDragContext *)tmp_list->data;
|
2001-08-19 18:34:59 +00:00
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if ((!context->is_source == !is_source) &&
|
2001-08-19 18:34:59 +00:00
|
|
|
((source == NULL) || (context->source_window && (context->source_window == source))) &&
|
|
|
|
((dest == NULL) || (context->dest_window && (context->dest_window == dest))))
|
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
|
|
|
return context;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
2001-08-19 18:34:59 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
IDropTarget idt;
|
|
|
|
#endif
|
|
|
|
GdkDragContext *context;
|
|
|
|
} target_drag_context;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
IDropSource ids;
|
|
|
|
#endif
|
|
|
|
GdkDragContext *context;
|
|
|
|
} source_drag_context;
|
|
|
|
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
typedef struct {
|
|
|
|
IDataObject ido;
|
|
|
|
int ref_count;
|
|
|
|
} data_object;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
IEnumFORMATETC ief;
|
|
|
|
int ref_count;
|
|
|
|
int ix;
|
|
|
|
} enum_formats;
|
|
|
|
|
|
|
|
static enum_formats *enum_formats_new (void);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
static ULONG STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_addref (LPDROPTARGET This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
target_drag_context *ctx = (target_drag_context *) This;
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
2000-07-25 20:38:35 +00:00
|
|
|
int ref_count = ++private->ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
gdk_drag_context_ref (ctx->context);
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
return ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_queryinterface (LPDROPTARGET This,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppvObject)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_queryinterface %p\n", This));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
|
|
|
|
PRINT_GUID (riid);
|
|
|
|
|
|
|
|
if (IsEqualGUID (riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
g_print ("...IUnknown\n");
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_addref (This);
|
1999-11-11 22:12:27 +00:00
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID (riid, &IID_IDropTarget))
|
|
|
|
{
|
|
|
|
g_print ("...IDropTarget\n");
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_addref (This);
|
1999-11-11 22:12:27 +00:00
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("...Huh?\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_release (LPDROPTARGET This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
target_drag_context *ctx = (target_drag_context *) This;
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
2000-07-25 20:38:35 +00:00
|
|
|
int ref_count = --private->ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
gdk_drag_context_unref (ctx->context);
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
if (ref_count == 0)
|
|
|
|
g_free (This);
|
|
|
|
|
|
|
|
return ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_dragenter (LPDROPTARGET This,
|
|
|
|
LPDATAOBJECT pDataObj,
|
|
|
|
DWORD grfKeyState,
|
|
|
|
POINTL pt,
|
|
|
|
LPDWORD pdwEffect)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_dragover (LPDROPTARGET This,
|
|
|
|
DWORD grfKeyState,
|
|
|
|
POINTL pt,
|
|
|
|
LPDWORD pdwEffect)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_dragover %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_dragleave (LPDROPTARGET This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_dragleave %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_drop (LPDROPTARGET This,
|
|
|
|
LPDATAOBJECT pDataObj,
|
|
|
|
DWORD grfKeyState,
|
|
|
|
POINTL pt,
|
|
|
|
LPDWORD pdwEffect)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idroptarget_drop %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_addref (LPDROPSOURCE This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
source_drag_context *ctx = (source_drag_context *) This;
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
gdk_drag_context_ref (ctx->context);
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n",
|
2000-05-07 19:45:27 +00:00
|
|
|
This, private->ref_count));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return private->ref_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_queryinterface (LPDROPSOURCE This,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppvObject)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idropsource_queryinterface %p\n", This));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
|
|
|
|
PRINT_GUID (riid);
|
|
|
|
if (IsEqualGUID (riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
g_print ("...IUnknown\n");
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_addref (This);
|
1999-11-11 22:12:27 +00:00
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID (riid, &IID_IDropSource))
|
|
|
|
{
|
|
|
|
g_print ("...IDropSource\n");
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_addref (This);
|
1999-11-11 22:12:27 +00:00
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("...Huh?\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_release (LPDROPSOURCE This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
source_drag_context *ctx = (source_drag_context *) This;
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
2000-07-25 20:38:35 +00:00
|
|
|
int ref_count = --private->ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
gdk_drag_context_unref (ctx->context);
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
if (ref_count == 0)
|
|
|
|
g_free (This);
|
|
|
|
|
|
|
|
return ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_querycontinuedrag (LPDROPSOURCE This,
|
|
|
|
BOOL fEscapePressed,
|
|
|
|
DWORD grfKeyState)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idropsource_querycontinuedrag %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_givefeedback (LPDROPSOURCE This,
|
|
|
|
DWORD dwEffect)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idropsource_givefeedback %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
static ULONG STDMETHODCALLTYPE
|
|
|
|
idataobject_addref (LPDATAOBJECT This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-05-07 19:45:27 +00:00
|
|
|
data_object *dobj = (data_object *) This;
|
|
|
|
int ref_count = ++dobj->ref_count;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_addref %p %d\n", This, ref_count));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
idataobject_queryinterface (LPDATAOBJECT This,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppvObject)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_queryinterface %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
|
|
|
|
PRINT_GUID (riid);
|
|
|
|
if (IsEqualGUID (riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
g_print ("...IUnknown\n");
|
|
|
|
idataobject_addref (This);
|
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID (riid, &IID_IDataObject))
|
|
|
|
{
|
|
|
|
g_print ("...IDataObject\n");
|
|
|
|
idataobject_addref (This);
|
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("...Huh?\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_release (LPDATAOBJECT This)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-05-07 19:45:27 +00:00
|
|
|
data_object *dobj = (data_object *) This;
|
|
|
|
int ref_count = --dobj->ref_count;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_release %p %d\n", This, ref_count));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
if (ref_count == 0)
|
|
|
|
g_free (This);
|
|
|
|
|
|
|
|
return ref_count;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_getdata (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatEtc,
|
|
|
|
LPSTGMEDIUM pMedium)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_getdata %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_getdatahere (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatEtc,
|
|
|
|
LPSTGMEDIUM pMedium)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_getdatahere %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_querygetdata (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatEtc)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-05-07 19:45:27 +00:00
|
|
|
int i;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_querygetdata %p %#x", This, pFormatEtc->cfFormat));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
for (i = 0; i < nformats; i++)
|
|
|
|
if (pFormatEtc->cfFormat == formats[i].cfFormat)
|
|
|
|
{
|
|
|
|
GDK_NOTE (DND, g_print (" S_OK\n"));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
GDK_NOTE (DND, g_print (" DV_E_FORMATETC\n"));
|
|
|
|
return DV_E_FORMATETC;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_getcanonicalformatetc (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatEtcIn,
|
|
|
|
LPFORMATETC pFormatEtcOut)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_getcanonicalformatetc %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_setdata (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatEtc,
|
|
|
|
LPSTGMEDIUM pMedium,
|
|
|
|
BOOL fRelease)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_setdata %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_enumformatetc (LPDATAOBJECT This,
|
|
|
|
DWORD dwDirection,
|
|
|
|
LPENUMFORMATETC *ppEnumFormatEtc)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_enumformatetc %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
if (dwDirection != DATADIR_GET)
|
|
|
|
return E_NOTIMPL;
|
|
|
|
|
|
|
|
*ppEnumFormatEtc = &enum_formats_new ()->ief;
|
|
|
|
return S_OK;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_dadvise (LPDATAOBJECT This,
|
|
|
|
LPFORMATETC pFormatetc,
|
|
|
|
DWORD advf,
|
|
|
|
LPADVISESINK pAdvSink,
|
|
|
|
DWORD *pdwConnection)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_dadvise %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_dunadvise (LPDATAOBJECT This,
|
|
|
|
DWORD dwConnection)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_dunadvise %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_enumdadvise (LPDATAOBJECT This,
|
|
|
|
LPENUMSTATDATA *ppenumAdvise)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("idataobject_enumdadvise %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
static ULONG STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_addref (LPENUMFORMATETC This)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
int ref_count = ++en->ref_count;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_addref %p %d\n", This, ref_count));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return ref_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_queryinterface (LPENUMFORMATETC This,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppvObject)
|
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_queryinterface %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
|
|
|
|
PRINT_GUID (riid);
|
|
|
|
if (IsEqualGUID (riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
g_print ("...IUnknown\n");
|
|
|
|
ienumformatetc_addref (This);
|
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID (riid, &IID_IEnumFORMATETC))
|
|
|
|
{
|
|
|
|
g_print ("...IEnumFORMATETC\n");
|
|
|
|
ienumformatetc_addref (This);
|
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("...Huh?\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_release (LPENUMFORMATETC This)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
int ref_count = --en->ref_count;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_release %p %d\n", This, ref_count));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
if (ref_count == 0)
|
|
|
|
g_free (This);
|
|
|
|
|
|
|
|
return ref_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_next (LPENUMFORMATETC This,
|
|
|
|
ULONG celt,
|
|
|
|
LPFORMATETC elts,
|
|
|
|
ULONG *nelt)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
int i, n;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_next %p %d %d\n", This, en->ix, celt));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
n = 0;
|
|
|
|
for (i = 0; i < celt; i++)
|
|
|
|
{
|
|
|
|
if (en->ix >= nformats)
|
|
|
|
break;
|
|
|
|
elts[i] = formats[en->ix++];
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nelt != NULL)
|
|
|
|
*nelt = n;
|
|
|
|
|
|
|
|
if (n == celt)
|
|
|
|
return S_OK;
|
|
|
|
else
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_skip (LPENUMFORMATETC This,
|
|
|
|
ULONG celt)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_skip %p %d %d\n", This, en->ix, celt));
|
2000-05-07 19:45:27 +00:00
|
|
|
en->ix += celt;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_reset (LPENUMFORMATETC This)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_reset %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
en->ix = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE
|
|
|
|
ienumformatetc_clone (LPENUMFORMATETC This,
|
|
|
|
LPENUMFORMATETC *ppEnumFormatEtc)
|
|
|
|
{
|
|
|
|
enum_formats *en = (enum_formats *) This;
|
|
|
|
enum_formats *new;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("ienumformatetc_clone %p\n", This));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
new = enum_formats_new ();
|
|
|
|
|
|
|
|
new->ix = en->ix;
|
|
|
|
|
|
|
|
*ppEnumFormatEtc = &new->ief;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
static IDropTargetVtbl idt_vtbl = {
|
2000-05-07 19:45:27 +00:00
|
|
|
idroptarget_queryinterface,
|
|
|
|
idroptarget_addref,
|
|
|
|
idroptarget_release,
|
|
|
|
idroptarget_dragenter,
|
|
|
|
idroptarget_dragover,
|
|
|
|
idroptarget_dragleave,
|
|
|
|
idroptarget_drop
|
1999-11-11 22:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static IDropSourceVtbl ids_vtbl = {
|
2000-05-07 19:45:27 +00:00
|
|
|
idropsource_queryinterface,
|
|
|
|
idropsource_addref,
|
|
|
|
idropsource_release,
|
|
|
|
idropsource_querycontinuedrag,
|
|
|
|
idropsource_givefeedback
|
1999-11-11 22:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static IDataObjectVtbl ido_vtbl = {
|
2000-05-07 19:45:27 +00:00
|
|
|
idataobject_queryinterface,
|
|
|
|
idataobject_addref,
|
|
|
|
idataobject_release,
|
|
|
|
idataobject_getdata,
|
|
|
|
idataobject_getdatahere,
|
|
|
|
idataobject_querygetdata,
|
|
|
|
idataobject_getcanonicalformatetc,
|
|
|
|
idataobject_setdata,
|
|
|
|
idataobject_enumformatetc,
|
|
|
|
idataobject_dadvise,
|
|
|
|
idataobject_dunadvise,
|
|
|
|
idataobject_enumdadvise
|
|
|
|
};
|
|
|
|
|
|
|
|
static IEnumFORMATETCVtbl ief_vtbl = {
|
|
|
|
ienumformatetc_queryinterface,
|
|
|
|
ienumformatetc_addref,
|
|
|
|
ienumformatetc_release,
|
|
|
|
ienumformatetc_next,
|
|
|
|
ienumformatetc_skip,
|
|
|
|
ienumformatetc_reset,
|
|
|
|
ienumformatetc_clone
|
1999-11-11 22:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static target_drag_context *
|
|
|
|
target_context_new (void)
|
|
|
|
{
|
|
|
|
target_drag_context *result;
|
|
|
|
|
|
|
|
result = g_new0 (target_drag_context, 1);
|
|
|
|
|
|
|
|
result->idt.lpVtbl = &idt_vtbl;
|
|
|
|
|
|
|
|
result->context = gdk_drag_context_new ();
|
2000-05-07 19:45:27 +00:00
|
|
|
result->context->is_source = FALSE;
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static source_drag_context *
|
|
|
|
source_context_new (void)
|
|
|
|
{
|
|
|
|
source_drag_context *result;
|
|
|
|
|
|
|
|
result = g_new0 (source_drag_context, 1);
|
|
|
|
|
|
|
|
result->ids.lpVtbl = &ids_vtbl;
|
|
|
|
|
|
|
|
result->context = gdk_drag_context_new ();
|
2000-05-07 19:45:27 +00:00
|
|
|
result->context->is_source = TRUE;
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
static data_object *
|
|
|
|
data_object_new (void)
|
|
|
|
{
|
|
|
|
data_object *result;
|
|
|
|
|
|
|
|
result = g_new0 (data_object, 1);
|
|
|
|
|
|
|
|
result->ido.lpVtbl = &ido_vtbl;
|
|
|
|
result->ref_count = 1;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("data_object_new: %p\n", result));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static enum_formats *
|
|
|
|
enum_formats_new (void)
|
|
|
|
{
|
|
|
|
enum_formats *result;
|
|
|
|
|
|
|
|
result = g_new0 (enum_formats, 1);
|
|
|
|
|
|
|
|
result->ief.lpVtbl = &ief_vtbl;
|
|
|
|
result->ref_count = 1;
|
|
|
|
result->ix = 0;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("enum_formats_new: %p\n", result));
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* From MS Knowledge Base article Q130698 */
|
|
|
|
|
|
|
|
/* resolve_link() fills the filename and path buffer
|
|
|
|
* with relevant information
|
|
|
|
* hWnd - calling app's window handle.
|
|
|
|
*
|
|
|
|
* lpszLinkName - name of the link file passed into the function.
|
|
|
|
*
|
|
|
|
* lpszPath - the buffer that will receive the file pathname.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT
|
2000-05-07 19:45:27 +00:00
|
|
|
resolve_link(HWND hWnd,
|
1999-11-11 22:12:27 +00:00
|
|
|
LPCTSTR lpszLinkName,
|
2000-05-07 19:45:27 +00:00
|
|
|
LPSTR lpszPath,
|
|
|
|
LPSTR lpszDescription)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
HRESULT hres;
|
|
|
|
IShellLink *psl;
|
|
|
|
WIN32_FIND_DATA wfd;
|
|
|
|
|
|
|
|
/* Assume Failure to start with: */
|
|
|
|
*lpszPath = 0;
|
|
|
|
if (lpszDescription)
|
|
|
|
*lpszDescription = 0;
|
|
|
|
|
|
|
|
/* Call CoCreateInstance to obtain the IShellLink interface
|
|
|
|
* pointer. This call fails if CoInitialize is not called, so it is
|
|
|
|
* assumed that CoInitialize has been called.
|
|
|
|
*/
|
|
|
|
|
|
|
|
hres = CoCreateInstance (&CLSID_ShellLink,
|
|
|
|
NULL,
|
|
|
|
CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IShellLink,
|
|
|
|
(LPVOID *)&psl);
|
|
|
|
if (SUCCEEDED (hres))
|
|
|
|
{
|
|
|
|
IPersistFile *ppf;
|
|
|
|
|
|
|
|
/* The IShellLink interface supports the IPersistFile
|
|
|
|
* interface. Get an interface pointer to it.
|
|
|
|
*/
|
|
|
|
hres = psl->lpVtbl->QueryInterface (psl,
|
|
|
|
&IID_IPersistFile,
|
|
|
|
(LPVOID *) &ppf);
|
|
|
|
if (SUCCEEDED (hres))
|
|
|
|
{
|
|
|
|
WORD wsz[MAX_PATH];
|
|
|
|
|
|
|
|
/* Convert the given link name string to wide character string. */
|
|
|
|
MultiByteToWideChar (CP_ACP, 0,
|
|
|
|
lpszLinkName,
|
|
|
|
-1, wsz, MAX_PATH);
|
|
|
|
/* Load the file. */
|
|
|
|
hres = ppf->lpVtbl->Load (ppf, wsz, STGM_READ);
|
|
|
|
if (SUCCEEDED (hres))
|
|
|
|
{
|
|
|
|
/* Resolve the link by calling the Resolve()
|
|
|
|
* interface function.
|
|
|
|
*/
|
|
|
|
hres = psl->lpVtbl->Resolve(psl, hWnd,
|
|
|
|
SLR_ANY_MATCH |
|
|
|
|
SLR_NO_UI);
|
|
|
|
if (SUCCEEDED (hres))
|
|
|
|
{
|
|
|
|
hres = psl->lpVtbl->GetPath (psl, lpszPath,
|
|
|
|
MAX_PATH,
|
|
|
|
(WIN32_FIND_DATA*)&wfd,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (SUCCEEDED (hres) && lpszDescription != NULL)
|
|
|
|
{
|
|
|
|
hres = psl->lpVtbl->GetDescription (psl,
|
|
|
|
lpszDescription,
|
|
|
|
MAX_PATH );
|
|
|
|
|
|
|
|
if (!SUCCEEDED (hres))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ppf->lpVtbl->Release (ppf);
|
|
|
|
}
|
|
|
|
psl->lpVtbl->Release (psl);
|
|
|
|
}
|
|
|
|
return SUCCEEDED (hres);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkFilterReturn
|
|
|
|
gdk_dropfiles_filter (GdkXEvent *xev,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GdkDragContext *context;
|
2000-07-25 20:38:35 +00:00
|
|
|
GdkDragContextPrivateWin32 *private;
|
1999-11-11 22:12:27 +00:00
|
|
|
GString *result;
|
|
|
|
MSG *msg = (MSG *) xev;
|
|
|
|
HANDLE hdrop;
|
|
|
|
POINT pt;
|
2000-10-09 19:49:42 +00:00
|
|
|
gint nfiles, i;
|
1999-11-11 22:12:27 +00:00
|
|
|
guchar fileName[MAX_PATH], linkedFile[MAX_PATH];
|
|
|
|
|
|
|
|
if (msg->message == WM_DROPFILES)
|
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("WM_DROPFILES: %p\n", msg->hwnd));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
context = gdk_drag_context_new ();
|
2001-08-19 18:34:59 +00:00
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
1999-11-11 22:12:27 +00:00
|
|
|
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
|
|
|
context->is_source = FALSE;
|
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
|
|
|
context->source_window = _gdk_parent_root;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (context->source_window);
|
1999-11-11 22:12:27 +00:00
|
|
|
context->dest_window = event->any.window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (context->dest_window);
|
1999-11-11 22:12:27 +00:00
|
|
|
/* WM_DROPFILES drops are always file names */
|
|
|
|
context->targets =
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
g_list_append (NULL, GUINT_TO_POINTER (_text_uri_list));
|
1999-11-11 22:12:27 +00:00
|
|
|
current_dest_drag = context;
|
|
|
|
|
|
|
|
event->dnd.type = GDK_DROP_START;
|
|
|
|
event->dnd.context = current_dest_drag;
|
|
|
|
|
|
|
|
hdrop = (HANDLE) msg->wParam;
|
|
|
|
DragQueryPoint (hdrop, &pt);
|
|
|
|
ClientToScreen (msg->hwnd, &pt);
|
|
|
|
|
|
|
|
event->dnd.x_root = pt.x;
|
|
|
|
event->dnd.y_root = pt.y;
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
event->dnd.time = _gdk_win32_get_next_tick (msg->time);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
nfiles = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
|
|
|
|
|
|
|
|
result = g_string_new (NULL);
|
|
|
|
for (i = 0; i < nfiles; i++)
|
|
|
|
{
|
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
|
|
|
gchar *uri;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
DragQueryFile (hdrop, i, fileName, MAX_PATH);
|
|
|
|
|
|
|
|
/* Resolve shortcuts */
|
|
|
|
if (resolve_link (msg->hwnd, fileName, linkedFile, NULL))
|
|
|
|
{
|
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
|
|
|
uri = g_filename_to_uri (linkedFile, NULL, NULL);
|
|
|
|
if (uri != NULL)
|
|
|
|
{
|
|
|
|
g_string_append (result, uri);
|
|
|
|
GDK_NOTE (DND, g_print ("...%s link to %s: %s\n",
|
|
|
|
fileName, linkedFile, uri));
|
|
|
|
g_free (uri);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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
|
|
|
uri = g_filename_to_uri (fileName, NULL, NULL);
|
|
|
|
if (uri != NULL)
|
|
|
|
{
|
|
|
|
g_string_append (result, uri);
|
|
|
|
GDK_NOTE (DND, g_print ("...%s: %s\n", fileName, uri));
|
|
|
|
g_free (uri);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
g_string_append (result, "\015\012");
|
|
|
|
}
|
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
|
|
|
_gdk_dropfiles_store (result->str);
|
|
|
|
g_string_free (result, FALSE);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
DragFinish (hdrop);
|
|
|
|
|
|
|
|
return GDK_FILTER_TRANSLATE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return GDK_FILTER_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
************************** Public API ***********************
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
void
|
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
|
|
|
_gdk_dnd_init (void)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
#ifdef OLE2_DND
|
2000-05-07 19:45:27 +00:00
|
|
|
HRESULT hres;
|
1999-11-11 22:12:27 +00:00
|
|
|
hres = OleInitialize (NULL);
|
|
|
|
|
|
|
|
if (! SUCCEEDED (hres))
|
|
|
|
g_error ("OleInitialize failed");
|
2000-05-07 19:45:27 +00:00
|
|
|
|
|
|
|
nformats = 2;
|
|
|
|
formats = g_new (FORMATETC, nformats);
|
|
|
|
|
|
|
|
formats[0].cfFormat = CF_TEXT;
|
|
|
|
formats[0].ptd = NULL;
|
|
|
|
formats[0].dwAspect = DVASPECT_CONTENT;
|
|
|
|
formats[0].lindex = -1;
|
|
|
|
formats[0].tymed = TYMED_HGLOBAL;
|
|
|
|
|
|
|
|
formats[1].cfFormat = CF_GDIOBJFIRST;
|
|
|
|
formats[1].ptd = NULL;
|
|
|
|
formats[1].dwAspect = DVASPECT_CONTENT;
|
|
|
|
formats[1].lindex = -1;
|
|
|
|
formats[1].tymed = TYMED_HGLOBAL;
|
1999-11-11 22:12:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-28 21:28:51 +00:00
|
|
|
_gdk_win32_dnd_exit (void)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
OleUninitialize ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Source side */
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
static void
|
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
|
|
|
local_send_leave (GdkDragContext *context,
|
|
|
|
guint32 time)
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
|
|
|
|
if ((current_dest_drag != NULL) &&
|
|
|
|
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
|
|
|
|
(current_dest_drag->source_window == context->source_window))
|
|
|
|
{
|
|
|
|
tmp_event.dnd.type = GDK_DRAG_LEAVE;
|
|
|
|
tmp_event.dnd.window = context->dest_window;
|
|
|
|
/* Pass ownership of context to the event */
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
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
|
|
|
tmp_event.dnd.context = current_dest_drag;
|
2001-08-19 18:34:59 +00:00
|
|
|
tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
|
|
|
|
|
|
|
|
current_dest_drag = NULL;
|
|
|
|
|
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
local_send_enter (GdkDragContext *context,
|
|
|
|
guint32 time)
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
GdkDragContextPrivateWin32 *private;
|
|
|
|
GdkDragContext *new_context;
|
|
|
|
|
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
|
|
|
|
|
|
|
if (current_dest_drag != NULL)
|
|
|
|
{
|
|
|
|
gdk_drag_context_unref (current_dest_drag);
|
|
|
|
current_dest_drag = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_context = gdk_drag_context_new ();
|
|
|
|
new_context->protocol = GDK_DRAG_PROTO_LOCAL;
|
|
|
|
new_context->is_source = FALSE;
|
|
|
|
|
|
|
|
new_context->source_window = context->source_window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (new_context->source_window);
|
2001-08-19 18:34:59 +00:00
|
|
|
new_context->dest_window = context->dest_window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (new_context->dest_window);
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
new_context->targets = g_list_copy (context->targets);
|
|
|
|
|
|
|
|
gdk_window_set_events (new_context->source_window,
|
|
|
|
gdk_window_get_events (new_context->source_window) |
|
|
|
|
GDK_PROPERTY_CHANGE_MASK);
|
|
|
|
new_context->actions = context->actions;
|
|
|
|
|
|
|
|
tmp_event.dnd.type = GDK_DRAG_ENTER;
|
|
|
|
tmp_event.dnd.window = context->dest_window;
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
|
|
|
tmp_event.dnd.context = new_context;
|
|
|
|
tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
|
|
|
|
|
|
|
|
current_dest_drag = new_context;
|
|
|
|
|
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
local_send_motion (GdkDragContext *context,
|
|
|
|
gint x_root,
|
|
|
|
gint y_root,
|
|
|
|
GdkDragAction action,
|
|
|
|
guint32 time)
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
|
|
|
|
if ((current_dest_drag != NULL) &&
|
|
|
|
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
|
|
|
|
(current_dest_drag->source_window == context->source_window))
|
|
|
|
{
|
|
|
|
tmp_event.dnd.type = GDK_DRAG_MOTION;
|
|
|
|
tmp_event.dnd.window = current_dest_drag->dest_window;
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
|
|
|
tmp_event.dnd.context = current_dest_drag;
|
|
|
|
tmp_event.dnd.time = time;
|
|
|
|
|
|
|
|
current_dest_drag->suggested_action = action;
|
|
|
|
current_dest_drag->actions = current_dest_drag->suggested_action;
|
|
|
|
|
|
|
|
tmp_event.dnd.x_root = x_root;
|
|
|
|
tmp_event.dnd.y_root = y_root;
|
|
|
|
|
|
|
|
(GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_x = x_root;
|
|
|
|
(GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_y = y_root;
|
|
|
|
|
|
|
|
GDK_DRAG_CONTEXT_PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
|
|
|
|
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
local_send_drop (GdkDragContext *context,
|
|
|
|
guint32 time)
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
|
|
|
|
if ((current_dest_drag != NULL) &&
|
|
|
|
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
|
|
|
|
(current_dest_drag->source_window == context->source_window))
|
|
|
|
{
|
|
|
|
GdkDragContextPrivateWin32 *private;
|
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag);
|
|
|
|
|
2004-02-28 13:21:25 +00:00
|
|
|
/* Pass ownership of context to the event */
|
2001-08-19 18:34:59 +00:00
|
|
|
tmp_event.dnd.type = GDK_DROP_START;
|
|
|
|
tmp_event.dnd.window = current_dest_drag->dest_window;
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
|
|
|
tmp_event.dnd.context = current_dest_drag;
|
|
|
|
tmp_event.dnd.time = GDK_CURRENT_TIME;
|
|
|
|
|
|
|
|
tmp_event.dnd.x_root = private->last_x;
|
|
|
|
tmp_event.dnd.y_root = private->last_y;
|
|
|
|
|
2004-02-28 13:21:25 +00:00
|
|
|
current_dest_drag = NULL;
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
static void
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_drag_do_leave (GdkDragContext *context,
|
|
|
|
guint32 time)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
if (context->dest_window)
|
|
|
|
{
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_do_leave\n"));
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
switch (context->protocol)
|
|
|
|
{
|
|
|
|
case GDK_DRAG_PROTO_LOCAL:
|
|
|
|
local_send_leave (context, time);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (context->dest_window);
|
1999-11-11 22:12:27 +00:00
|
|
|
context->dest_window = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkDragContext *
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_drag_begin (GdkWindow *window,
|
|
|
|
GList *targets)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
#ifndef OLE2_DND
|
|
|
|
GList *tmp_list;
|
|
|
|
GdkDragContext *new_context;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window != NULL, NULL);
|
|
|
|
|
|
|
|
new_context = gdk_drag_context_new ();
|
|
|
|
new_context->is_source = TRUE;
|
|
|
|
new_context->source_window = window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (window);
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
tmp_list = g_list_last (targets);
|
|
|
|
new_context->targets = NULL;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
new_context->targets = g_list_prepend (new_context->targets,
|
|
|
|
tmp_list->data);
|
|
|
|
tmp_list = tmp_list->prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_context->actions = 0;
|
|
|
|
|
|
|
|
return new_context;
|
|
|
|
#else
|
1999-11-11 22:12:27 +00:00
|
|
|
source_drag_context *ctx;
|
2000-10-09 19:49:42 +00:00
|
|
|
GList *tmp_list;
|
2000-05-07 19:45:27 +00:00
|
|
|
data_object *dobj;
|
|
|
|
HRESULT hResult;
|
|
|
|
DWORD dwEffect;
|
|
|
|
HGLOBAL global;
|
|
|
|
FORMATETC format;
|
|
|
|
STGMEDIUM medium;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_val_if_fail (window != NULL, NULL);
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_begin\n"));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
ctx = source_context_new ();
|
2000-05-07 19:45:27 +00:00
|
|
|
ctx->context->protocol = GDK_DRAG_PROTO_OLE2;
|
1999-11-11 22:12:27 +00:00
|
|
|
ctx->context->source_window = window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
tmp_list = g_list_last (targets);
|
|
|
|
ctx->context->targets = NULL;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
ctx->context->targets = g_list_prepend (ctx->context->targets,
|
|
|
|
tmp_list->data);
|
|
|
|
tmp_list = tmp_list->prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->context->actions = 0;
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
dobj = data_object_new ();
|
|
|
|
|
|
|
|
global = GlobalAlloc (GMEM_FIXED, sizeof (ctx));
|
|
|
|
|
|
|
|
memcpy (&global, ctx, sizeof (ctx));
|
|
|
|
|
|
|
|
medium.tymed = TYMED_HGLOBAL;
|
|
|
|
medium.hGlobal = global;
|
|
|
|
medium.pUnkForRelease = NULL;
|
|
|
|
|
|
|
|
dobj->ido.lpVtbl->SetData (&dobj->ido, &formats[1], &medium, TRUE);
|
|
|
|
|
|
|
|
hResult = DoDragDrop (&dobj->ido, &ctx->ids, DROPEFFECT_MOVE|DROPEFFECT_COPY, &dwEffect);
|
|
|
|
|
|
|
|
GDK_NOTE (DND, g_print ("DoDragDrop returned %s\n",
|
|
|
|
(hResult == DRAGDROP_S_DROP ? "DRAGDROP_S_DROP" :
|
|
|
|
(hResult == DRAGDROP_S_CANCEL ? "DRAGDROP_S_CANCEL" :
|
|
|
|
(hResult == E_UNEXPECTED ? "E_UNEXPECTED" :
|
|
|
|
g_strdup_printf ("%#.8x", hResult))))));
|
|
|
|
|
|
|
|
dobj->ido.lpVtbl->Release (&dobj->ido);
|
|
|
|
ctx->ids.lpVtbl->Release (&ctx->ids);
|
2001-08-19 18:34:59 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return ctx->context;
|
2001-08-19 18:34:59 +00:00
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
guint32
|
2002-10-07 20:03:15 +00:00
|
|
|
gdk_drag_get_protocol_for_display (GdkDisplay *display,
|
|
|
|
guint32 xid,
|
|
|
|
GdkDragProtocol *protocol)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkWindow *window;
|
|
|
|
|
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_get_protocol\n"));
|
|
|
|
|
|
|
|
window = gdk_window_lookup (xid);
|
|
|
|
|
|
|
|
if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
|
|
|
|
{
|
|
|
|
*protocol = GDK_DRAG_PROTO_LOCAL;
|
|
|
|
return xid;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
typedef struct {
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
HWND ignore;
|
|
|
|
HWND result;
|
|
|
|
} find_window_enum_arg;
|
|
|
|
|
|
|
|
static BOOL CALLBACK
|
|
|
|
find_window_enum_proc (HWND hwnd,
|
|
|
|
LPARAM lparam)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
POINT tl, br;
|
|
|
|
find_window_enum_arg *a = (find_window_enum_arg *) lparam;
|
|
|
|
|
|
|
|
if (hwnd == a->ignore)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!IsWindowVisible (hwnd))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
tl.x = tl.y = 0;
|
|
|
|
ClientToScreen (hwnd, &tl);
|
|
|
|
GetClientRect (hwnd, &rect);
|
|
|
|
br.x = rect.right;
|
|
|
|
br.y = rect.bottom;
|
|
|
|
ClientToScreen (hwnd, &br);
|
|
|
|
|
|
|
|
if (a->x >= tl.x && a->y >= tl.y && a->x < br.x && a->y < br.y)
|
|
|
|
{
|
|
|
|
a->result = hwnd;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
2002-10-07 20:03:15 +00:00
|
|
|
gdk_drag_find_window_for_screen (GdkDragContext *context,
|
|
|
|
GdkWindow *drag_window,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint x_root,
|
|
|
|
gint y_root,
|
|
|
|
GdkWindow **dest_window,
|
|
|
|
GdkDragProtocol *protocol)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
find_window_enum_arg a;
|
|
|
|
|
2004-05-05 02:18:21 +00:00
|
|
|
a.x = x_root - _gdk_offset_x;
|
|
|
|
a.y = y_root - _gdk_offset_y;
|
2003-06-30 21:58:24 +00:00
|
|
|
a.ignore = drag_window ? GDK_WINDOW_HWND (drag_window) : NULL;
|
|
|
|
a.result = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
EnumWindows (find_window_enum_proc, (LPARAM) &a);
|
|
|
|
|
|
|
|
if (a.result == NULL)
|
1999-11-11 22:12:27 +00:00
|
|
|
*dest_window = NULL;
|
|
|
|
else
|
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
*dest_window = gdk_win32_handle_table_lookup (GPOINTER_TO_UINT (a.result));
|
1999-11-11 22:12:27 +00:00
|
|
|
if (*dest_window)
|
2002-03-19 23:16:08 +00:00
|
|
|
{
|
|
|
|
*dest_window = gdk_window_get_toplevel (*dest_window);
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (*dest_window);
|
2002-03-19 23:16:08 +00:00
|
|
|
}
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
if (context->source_window)
|
|
|
|
*protocol = GDK_DRAG_PROTO_LOCAL;
|
|
|
|
else
|
|
|
|
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2001-08-19 18:34:59 +00:00
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND,
|
|
|
|
g_print ("gdk_drag_find_window: %p +%d+%d: %p: %p %d\n",
|
|
|
|
(drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
|
|
|
|
x_root, y_root,
|
|
|
|
a.result,
|
|
|
|
(*dest_window ? GDK_WINDOW_HWND (*dest_window) : NULL),
|
|
|
|
*protocol));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_drag_motion (GdkDragContext *context,
|
|
|
|
GdkWindow *dest_window,
|
|
|
|
GdkDragProtocol protocol,
|
|
|
|
gint x_root,
|
|
|
|
gint y_root,
|
|
|
|
GdkDragAction suggested_action,
|
|
|
|
GdkDragAction possible_actions,
|
|
|
|
guint32 time)
|
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private;
|
|
|
|
|
|
|
|
g_return_val_if_fail (context != NULL, FALSE);
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_motion\n"));
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
|
|
|
|
|
|
|
if (context->dest_window != dest_window)
|
|
|
|
{
|
|
|
|
GdkEvent temp_event;
|
|
|
|
|
|
|
|
/* Send a leave to the last destination */
|
|
|
|
gdk_drag_do_leave (context, time);
|
|
|
|
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
|
|
|
|
|
|
|
/* Check if new destination accepts drags, and which protocol */
|
|
|
|
if (dest_window)
|
|
|
|
{
|
|
|
|
context->dest_window = dest_window;
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (context->dest_window);
|
2001-08-19 18:34:59 +00:00
|
|
|
context->protocol = protocol;
|
|
|
|
|
|
|
|
switch (protocol)
|
|
|
|
{
|
|
|
|
case GDK_DRAG_PROTO_LOCAL:
|
|
|
|
local_send_enter (context, time);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
context->suggested_action = suggested_action;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->dest_window = NULL;
|
|
|
|
context->action = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Push a status event, to let the client know that
|
|
|
|
* the drag changed
|
|
|
|
*/
|
|
|
|
|
|
|
|
temp_event.dnd.type = GDK_DRAG_STATUS;
|
|
|
|
temp_event.dnd.window = context->source_window;
|
|
|
|
/* We use this to signal a synthetic status. Perhaps
|
|
|
|
* we should use an extra field...
|
|
|
|
*/
|
|
|
|
temp_event.dnd.send_event = TRUE;
|
|
|
|
|
|
|
|
temp_event.dnd.context = context;
|
|
|
|
temp_event.dnd.time = time;
|
|
|
|
|
|
|
|
gdk_event_put (&temp_event);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->suggested_action = suggested_action;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send a drag-motion event */
|
|
|
|
|
|
|
|
private->last_x = x_root;
|
|
|
|
private->last_y = y_root;
|
|
|
|
|
|
|
|
if (context->dest_window)
|
|
|
|
{
|
|
|
|
if (private->drag_status == GDK_DRAG_STATUS_DRAG)
|
|
|
|
{
|
|
|
|
switch (context->protocol)
|
|
|
|
{
|
|
|
|
case GDK_DRAG_PROTO_LOCAL:
|
|
|
|
local_send_motion (context, x_root, y_root, suggested_action, time);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_DRAG_PROTO_NONE:
|
|
|
|
g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_motion()");
|
|
|
|
break;
|
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
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_drag_drop (GdkDragContext *context,
|
|
|
|
guint32 time)
|
|
|
|
{
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_drop\n"));
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
if (context->dest_window)
|
|
|
|
{
|
|
|
|
switch (context->protocol)
|
|
|
|
{
|
|
|
|
case GDK_DRAG_PROTO_LOCAL:
|
|
|
|
local_send_drop (context, time);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_DRAG_PROTO_NONE:
|
|
|
|
g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()");
|
|
|
|
break;
|
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
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_drag_abort (GdkDragContext *context,
|
|
|
|
guint32 time)
|
|
|
|
{
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drag_abort\n"));
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
gdk_drag_do_leave (context, time);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Destination side */
|
|
|
|
|
|
|
|
void
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_drag_status (GdkDragContext *context,
|
|
|
|
GdkDragAction action,
|
|
|
|
guint32 time)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private;
|
|
|
|
GdkDragContext *src_context;
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
context->action = action;
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
src_context = gdk_drag_context_find (TRUE,
|
|
|
|
context->source_window,
|
|
|
|
context->dest_window);
|
|
|
|
|
|
|
|
if (src_context)
|
|
|
|
{
|
|
|
|
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (src_context);
|
|
|
|
|
|
|
|
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
|
|
|
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
|
|
|
|
|
|
|
tmp_event.dnd.type = GDK_DRAG_STATUS;
|
|
|
|
tmp_event.dnd.window = context->source_window;
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
|
|
|
tmp_event.dnd.context = src_context;
|
|
|
|
tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
|
|
|
|
|
|
|
|
if (action == GDK_ACTION_DEFAULT)
|
|
|
|
action = 0;
|
|
|
|
|
|
|
|
src_context->action = action;
|
|
|
|
|
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_drop_reply (GdkDragContext *context,
|
|
|
|
gboolean ok,
|
|
|
|
guint32 time)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
2000-05-07 19:45:27 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drop_reply\n"));
|
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
|
|
|
|
|
|
|
if (context->dest_window)
|
|
|
|
{
|
|
|
|
switch (context->protocol)
|
|
|
|
{
|
|
|
|
case GDK_DRAG_PROTO_WIN32_DROPFILES:
|
|
|
|
_gdk_dropfiles_store (NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_drop_finish (GdkDragContext *context,
|
|
|
|
gboolean success,
|
|
|
|
guint32 time)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
GdkDragContextPrivateWin32 *private;
|
|
|
|
GdkDragContext *src_context;
|
|
|
|
GdkEvent tmp_event;
|
|
|
|
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
2004-02-28 13:21:25 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_drop_finish"));
|
2001-08-19 18:34:59 +00:00
|
|
|
|
|
|
|
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
|
|
|
|
|
|
|
src_context = gdk_drag_context_find (TRUE,
|
|
|
|
context->source_window,
|
|
|
|
context->dest_window);
|
|
|
|
if (src_context)
|
|
|
|
{
|
|
|
|
tmp_event.dnd.type = GDK_DROP_FINISHED;
|
|
|
|
tmp_event.dnd.window = src_context->source_window;
|
|
|
|
tmp_event.dnd.send_event = FALSE;
|
|
|
|
tmp_event.dnd.context = src_context;
|
|
|
|
|
|
|
|
gdk_event_put (&tmp_event);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-11-11 18:39:57 +00:00
|
|
|
#ifdef OLE2_DND
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
static GdkFilterReturn
|
|
|
|
gdk_destroy_filter (GdkXEvent *xev,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MSG *msg = (MSG *) xev;
|
|
|
|
|
|
|
|
if (msg->message == WM_DESTROY)
|
|
|
|
{
|
|
|
|
IDropTarget *idtp = (IDropTarget *) data;
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_destroy_filter: WM_DESTROY: %p\n", msg->hwnd));
|
2000-05-07 19:45:27 +00:00
|
|
|
#if 0
|
|
|
|
idtp->lpVtbl->Release (idtp);
|
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
RevokeDragDrop (msg->hwnd);
|
|
|
|
CoLockObjectExternal (idtp, FALSE, TRUE);
|
|
|
|
}
|
|
|
|
return GDK_FILTER_CONTINUE;
|
|
|
|
}
|
2000-11-11 18:39:57 +00:00
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
void
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_window_register_dnd (GdkWindow *window)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
#ifdef OLE2_DND
|
2000-05-07 19:45:27 +00:00
|
|
|
target_drag_context *ctx;
|
1999-11-11 22:12:27 +00:00
|
|
|
HRESULT hres;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
|
|
|
|
return;
|
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
|
|
|
|
|
|
|
gdk_drawable_set_data (window, "gdk-dnd-registered", GINT_TO_POINTER(TRUE), NULL);
|
2001-08-19 18:34:59 +00:00
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
GDK_NOTE (DND, g_print ("gdk_window_register_dnd: %p\n",
|
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* We always claim to accept dropped files, but in fact we might not,
|
|
|
|
* of course. This function is called in such a way that it cannot know
|
|
|
|
* whether the window (widget) in question actually accepts files
|
|
|
|
* (in gtk, data of type text/uri-list) or not.
|
|
|
|
*/
|
|
|
|
gdk_window_add_filter (window, gdk_dropfiles_filter, NULL);
|
2000-07-23 21:43:23 +00:00
|
|
|
DragAcceptFiles (GDK_WINDOW_HWND (window), TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
#ifdef OLE2_DND
|
|
|
|
/* Register for OLE2 d&d */
|
2000-05-07 19:45:27 +00:00
|
|
|
ctx = target_context_new ();
|
|
|
|
ctx->context->protocol = GDK_DRAG_PROTO_OLE2;
|
|
|
|
hres = CoLockObjectExternal ((IUnknown *) &ctx->idt, TRUE, FALSE);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (!SUCCEEDED (hres))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
OTHER_API_FAILED ("CoLockObjectExternal");
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
hres = RegisterDragDrop (GDK_WINDOW_HWND (window), &ctx->idt);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (hres == DRAGDROP_E_ALREADYREGISTERED)
|
|
|
|
{
|
|
|
|
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
|
2000-05-07 19:45:27 +00:00
|
|
|
#if 0
|
|
|
|
ctx->idt.lpVtbl->Release (&ctx->idt);
|
|
|
|
#endif
|
|
|
|
CoLockObjectExternal ((IUnknown *) &ctx->idt, FALSE, FALSE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else if (!SUCCEEDED (hres))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
OTHER_API_FAILED ("RegisterDragDrop");
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
|
|
|
{
|
2000-05-07 19:45:27 +00:00
|
|
|
gdk_window_add_filter (window, gdk_destroy_filter, &ctx->idt);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
* gdk_drag_get_selection:
|
|
|
|
* Returns the selection atom for the current source window
|
|
|
|
* arguments:
|
|
|
|
*
|
|
|
|
* results:
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
GdkAtom
|
|
|
|
gdk_drag_get_selection (GdkDragContext *context)
|
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
if (context->protocol == GDK_DRAG_PROTO_LOCAL)
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
return _local_dnd;
|
2001-08-19 18:34:59 +00:00
|
|
|
else if (context->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES)
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
return _gdk_win32_dropfiles;
|
1999-11-11 22:12:27 +00:00
|
|
|
else if (context->protocol == GDK_DRAG_PROTO_OLE2)
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
return _gdk_ole2_dnd;
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
|
|
|
return GDK_NONE;
|
|
|
|
}
|