Use nifty macros. (print_event_mask): Remove, use event_mask_string().
2002-01-09 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkevents-win32.c (event_mask_string, print_event, print_event_state): Use nifty macros. (print_event_mask): Remove, use event_mask_string(). * 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, always as single-element text list or single-component compound text. 2002-01-09 Tor Lillqvist <tml@iki.fi> * 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. 2002-01-09 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set) * gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do support PRIMARY. Seems to work fine after all (intra-app). 2002-01-09 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkglobals-win32.c: New global variables compound_text_atom, cf_rtf and cf_utf8_string. * gdk/win32/gdkprivate-win32.h: Declare them. * gdk/win32/gdkmain-win32.c: Initialise them. * gdk/win32/gdkproperty-win32.c * gdk/win32/gdkselection-win32.c: Use them. 2002-01-09 Tor Lillqvist <tml@iki.fi> * 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/gdkevents-win32.c (gdk_event_translate): Correspondingly, for the messages that shouldn't come in any longer, assert if one does. Will remove the gdk_selection_*_msg variables and handling code completely after a while. 2002-01-09 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function, converts from a wchar_t string to UTF-8. * gdk/win32/gdkprivate-win32.h: Declare it. * gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
This commit is contained in:
committed by
Tor Lillqvist
parent
62e41803eb
commit
9863dfa44c
57
ChangeLog
57
ChangeLog
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (event_mask_string, print_event,
|
||||
print_event_state): Use nifty macros.
|
||||
(print_event_mask): Remove, use event_mask_string().
|
||||
|
||||
* 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, always as
|
||||
single-element text list or single-component compound text.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_set)
|
||||
* gdk/win32/gdkselection-win32.c (gdk_selection_owner_get): Do
|
||||
support PRIMARY. Seems to work fine after all (intra-app).
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkglobals-win32.c: New global variables
|
||||
compound_text_atom, cf_rtf and cf_utf8_string.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare them.
|
||||
|
||||
* gdk/win32/gdkmain-win32.c: Initialise them.
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c
|
||||
* gdk/win32/gdkselection-win32.c: Use them.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* 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/gdkevents-win32.c (gdk_event_translate):
|
||||
Correspondingly, for the messages that shouldn't come in any
|
||||
longer, assert if one does. Will remove the gdk_selection_*_msg
|
||||
variables and handling code completely after a while.
|
||||
|
||||
2002-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/gdkim-win32.c (gdk_nwchar_ts_to_mbs): New function,
|
||||
converts from a wchar_t string to UTF-8.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Declare it.
|
||||
|
||||
* gdk/win32/gdkevents-win32.c (build_keypress_event): Use it.
|
||||
|
||||
2002-01-08 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Solve the Unicode issue with copying text to the Windows
|
||||
|
||||
@@ -2467,9 +2467,9 @@ build_keypress_event (GdkWindowWin32Data *windata,
|
||||
MSG *xevent)
|
||||
{
|
||||
HIMC hIMC;
|
||||
gint i, bytecount, ucount, ucleft, len;
|
||||
guchar buf[100], *bp;
|
||||
wchar_t wbuf[100], *wcp;
|
||||
gint i, bytecount, ucount;
|
||||
guchar buf[100];
|
||||
wchar_t wbuf[100];
|
||||
|
||||
event->key.type = GDK_KEY_PRESS;
|
||||
event->key.time = xevent->time;
|
||||
@@ -2516,8 +2516,7 @@ build_keypress_event (GdkWindowWin32Data *windata,
|
||||
*/
|
||||
ucount = MultiByteToWideChar (windata->charset_info.ciACP,
|
||||
0, buf, bytecount,
|
||||
wbuf, sizeof (wbuf) / sizeof (wbuf[0]));
|
||||
|
||||
wbuf, G_N_ELEMENTS (wbuf));
|
||||
}
|
||||
if (ucount == 0)
|
||||
event->key.keyval = GDK_VoidSymbol;
|
||||
@@ -2538,68 +2537,18 @@ build_keypress_event (GdkWindowWin32Data *windata,
|
||||
build_key_event_state (event);
|
||||
|
||||
/* Build UTF-8 string */
|
||||
ucleft = ucount;
|
||||
len = 0;
|
||||
wcp = wbuf;
|
||||
while (ucleft-- > 0)
|
||||
if (ucount == 1 && wbuf[0] < 0200)
|
||||
{
|
||||
wchar_t c = *wcp++;
|
||||
|
||||
if (c < 0x80)
|
||||
len += 1;
|
||||
else if (c < 0x800)
|
||||
len += 2;
|
||||
else
|
||||
len += 3;
|
||||
event->key.string = g_malloc (2);
|
||||
event->key.string[0] = wbuf[0];
|
||||
event->key.string[1] = '\0';
|
||||
event->key.length = 1;
|
||||
}
|
||||
|
||||
event->key.string = g_malloc (len + 1);
|
||||
event->key.length = len;
|
||||
|
||||
ucleft = ucount;
|
||||
wcp = wbuf;
|
||||
bp = event->key.string;
|
||||
while (ucleft-- > 0)
|
||||
else
|
||||
{
|
||||
int first;
|
||||
wchar_t c = *wcp++;
|
||||
|
||||
if (c < 0x80)
|
||||
{
|
||||
first = 0;
|
||||
len = 1;
|
||||
}
|
||||
else if (c < 0x800)
|
||||
{
|
||||
first = 0xc0;
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = 0xe0;
|
||||
len = 3;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Woo-hoo! */
|
||||
switch (len)
|
||||
{
|
||||
case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
|
||||
case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
|
||||
case 1: bp[0] = c | first;
|
||||
}
|
||||
#else
|
||||
for (i = len - 1; i > 0; --i)
|
||||
{
|
||||
bp[i] = (c & 0x3f) | 0x80;
|
||||
c >>= 6;
|
||||
}
|
||||
bp[0] = c | first;
|
||||
#endif
|
||||
|
||||
bp += len;
|
||||
event->key.string = gdk_nwchar_ts_to_mbs (wbuf, ucount);
|
||||
event->key.length = strlen (event->key.string);
|
||||
}
|
||||
*bp = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2632,70 +2581,21 @@ build_keyrelease_event (GdkWindowWin32Data *windata,
|
||||
event->key.length = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
print_event_mask (gint mask)
|
||||
{
|
||||
if (mask & GDK_EXPOSURE_MASK)
|
||||
g_print ("EXPOSURE ");
|
||||
if (mask & GDK_POINTER_MOTION_MASK)
|
||||
g_print ("POINTER_MOTION ");
|
||||
if (mask & GDK_POINTER_MOTION_HINT_MASK)
|
||||
g_print ("POINTER_MOTION_HINT ");
|
||||
if (mask & GDK_BUTTON_MOTION_MASK)
|
||||
g_print ("BUTTON_MOTION ");
|
||||
if (mask & GDK_BUTTON1_MOTION_MASK)
|
||||
g_print ("BUTTON1_MOTION ");
|
||||
if (mask & GDK_BUTTON2_MOTION_MASK)
|
||||
g_print ("BUTTON2_MOTION ");
|
||||
if (mask & GDK_BUTTON3_MOTION_MASK)
|
||||
g_print ("BUTTON3_MOTION ");
|
||||
if (mask & GDK_BUTTON_PRESS_MASK)
|
||||
g_print ("BUTTON_PRESS ");
|
||||
if (mask & GDK_BUTTON_RELEASE_MASK)
|
||||
g_print ("BUTTON_RELEASE ");
|
||||
if (mask & GDK_KEY_PRESS_MASK)
|
||||
g_print ("KEY_PRESS ");
|
||||
if (mask & GDK_KEY_RELEASE_MASK)
|
||||
g_print ("KEY_RELEASE ");
|
||||
if (mask & GDK_ENTER_NOTIFY_MASK)
|
||||
g_print ("ENTER_NOTIFY ");
|
||||
if (mask & GDK_LEAVE_NOTIFY_MASK)
|
||||
g_print ("LEAVE_NOTIFY ");
|
||||
if (mask & GDK_FOCUS_CHANGE_MASK)
|
||||
g_print ("FOCUS_CHANGE ");
|
||||
if (mask & GDK_STRUCTURE_MASK)
|
||||
g_print ("STRUCTURE ");
|
||||
if (mask & GDK_PROPERTY_CHANGE_MASK)
|
||||
g_print ("PROPERTY_CHANGE ");
|
||||
if (mask & GDK_VISIBILITY_NOTIFY_MASK)
|
||||
g_print ("VISIBILITY_NOTIFY ");
|
||||
if (mask & GDK_PROXIMITY_IN_MASK)
|
||||
g_print ("PROXIMITY_IN ");
|
||||
if (mask & GDK_PROXIMITY_OUT_MASK)
|
||||
g_print ("PROXIMITY_OUT ");
|
||||
if (mask & GDK_SUBSTRUCTURE_MASK)
|
||||
g_print ("SUBSTRUCTURE ");
|
||||
if (mask & GDK_SCROLL_MASK)
|
||||
g_print ("SCROLL ");
|
||||
}
|
||||
|
||||
static void
|
||||
print_event_state (gint state)
|
||||
{
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
g_print ("SHIFT ");
|
||||
if (state & GDK_LOCK_MASK)
|
||||
g_print ("LOCK ");
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
g_print ("CONTROL ");
|
||||
if (state & GDK_MOD1_MASK)
|
||||
g_print ("MOD1 ");
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
g_print ("BUTTON1 ");
|
||||
if (state & GDK_BUTTON2_MASK)
|
||||
g_print ("BUTTON2 ");
|
||||
if (state & GDK_BUTTON3_MASK)
|
||||
g_print ("BUTTON3 ");
|
||||
#define BIT(x) \
|
||||
if (state & GDK_##x##_MASK) \
|
||||
g_print (#x " ");
|
||||
|
||||
BIT (SHIFT);
|
||||
BIT (LOCK);
|
||||
BIT (CONTROL);
|
||||
BIT (MOD1);
|
||||
BIT (BUTTON1);
|
||||
BIT (BUTTON2);
|
||||
BIT (BUTTON3);
|
||||
#undef BIT
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2705,39 +2605,41 @@ print_event (GdkEvent *event)
|
||||
|
||||
switch (event->any.type)
|
||||
{
|
||||
case GDK_NOTHING: g_print ("GDK_NOTHING "); break;
|
||||
case GDK_DELETE: g_print ("GDK_DELETE "); break;
|
||||
case GDK_DESTROY: g_print ("GDK_DESTROY "); break;
|
||||
case GDK_EXPOSE: g_print ("GDK_EXPOSE "); break;
|
||||
case GDK_MOTION_NOTIFY: g_print ("GDK_MOTION_NOTIFY "); break;
|
||||
case GDK_BUTTON_PRESS: g_print ("GDK_BUTTON_PRESS "); break;
|
||||
case GDK_2BUTTON_PRESS: g_print ("GDK_2BUTTON_PRESS "); break;
|
||||
case GDK_3BUTTON_PRESS: g_print ("GDK_3BUTTON_PRESS "); break;
|
||||
case GDK_BUTTON_RELEASE: g_print ("GDK_BUTTON_RELEASE "); break;
|
||||
case GDK_KEY_PRESS: g_print ("GDK_KEY_PRESS "); break;
|
||||
case GDK_KEY_RELEASE: g_print ("GDK_KEY_RELEASE "); break;
|
||||
case GDK_ENTER_NOTIFY: g_print ("GDK_ENTER_NOTIFY "); break;
|
||||
case GDK_LEAVE_NOTIFY: g_print ("GDK_LEAVE_NOTIFY "); break;
|
||||
case GDK_FOCUS_CHANGE: g_print ("GDK_FOCUS_CHANGE "); break;
|
||||
case GDK_CONFIGURE: g_print ("GDK_CONFIGURE "); break;
|
||||
case GDK_MAP: g_print ("GDK_MAP "); break;
|
||||
case GDK_UNMAP: g_print ("GDK_UNMAP "); break;
|
||||
case GDK_PROPERTY_NOTIFY: g_print ("GDK_PROPERTY_NOTIFY "); break;
|
||||
case GDK_SELECTION_CLEAR: g_print ("GDK_SELECTION_CLEAR "); break;
|
||||
case GDK_SELECTION_REQUEST: g_print ("GDK_SELECTION_REQUEST "); break;
|
||||
case GDK_SELECTION_NOTIFY: g_print ("GDK_SELECTION_NOTIFY "); break;
|
||||
case GDK_PROXIMITY_IN: g_print ("GDK_PROXIMITY_IN "); break;
|
||||
case GDK_PROXIMITY_OUT: g_print ("GDK_PROXIMITY_OUT "); break;
|
||||
case GDK_DRAG_ENTER: g_print ("GDK_DRAG_ENTER "); break;
|
||||
case GDK_DRAG_LEAVE: g_print ("GDK_DRAG_LEAVE "); break;
|
||||
case GDK_DRAG_MOTION: g_print ("GDK_DRAG_MOTION "); break;
|
||||
case GDK_DRAG_STATUS: g_print ("GDK_DRAG_STATUS "); break;
|
||||
case GDK_DROP_START: g_print ("GDK_DROP_START "); break;
|
||||
case GDK_DROP_FINISHED: g_print ("GDK_DROP_FINISHED "); break;
|
||||
case GDK_CLIENT_EVENT: g_print ("GDK_CLIENT_EVENT "); break;
|
||||
case GDK_VISIBILITY_NOTIFY: g_print ("GDK_VISIBILITY_NOTIFY "); break;
|
||||
case GDK_NO_EXPOSE: g_print ("GDK_NO_EXPOSE "); break;
|
||||
case GDK_SCROLL: g_print ("GDK_SCROLL "); break;
|
||||
#define CASE(x) case GDK_##x: g_print (#x " "); break;
|
||||
CASE (NOTHING);
|
||||
CASE (DELETE);
|
||||
CASE (DESTROY);
|
||||
CASE (EXPOSE);
|
||||
CASE (MOTION_NOTIFY);
|
||||
CASE (BUTTON_PRESS);
|
||||
CASE (2BUTTON_PRESS);
|
||||
CASE (3BUTTON_PRESS);
|
||||
CASE (BUTTON_RELEASE);
|
||||
CASE (KEY_PRESS);
|
||||
CASE (KEY_RELEASE);
|
||||
CASE (ENTER_NOTIFY);
|
||||
CASE (LEAVE_NOTIFY);
|
||||
CASE (FOCUS_CHANGE);
|
||||
CASE (CONFIGURE);
|
||||
CASE (MAP);
|
||||
CASE (UNMAP);
|
||||
CASE (PROPERTY_NOTIFY);
|
||||
CASE (SELECTION_CLEAR);
|
||||
CASE (SELECTION_REQUEST);
|
||||
CASE (SELECTION_NOTIFY);
|
||||
CASE (PROXIMITY_IN);
|
||||
CASE (PROXIMITY_OUT);
|
||||
CASE (DRAG_ENTER);
|
||||
CASE (DRAG_LEAVE);
|
||||
CASE (DRAG_MOTION);
|
||||
CASE (DRAG_STATUS);
|
||||
CASE (DROP_START);
|
||||
CASE (DROP_FINISHED);
|
||||
CASE (CLIENT_EVENT);
|
||||
CASE (VISIBILITY_NOTIFY);
|
||||
CASE (NO_EXPOSE);
|
||||
CASE (SCROLL);
|
||||
#undef CASE
|
||||
}
|
||||
g_print ("%#x ", (guint) GDK_DRAWABLE_XID (event->any.window));
|
||||
|
||||
@@ -3429,8 +3331,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
if (xevent->message == gdk_selection_notify_msg)
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print ("gdk_selection_notify_msg: %#x\n",
|
||||
(guint) xevent->hwnd));
|
||||
g_print ("gdk_selection_notify_msg: %#x\n",
|
||||
(guint) xevent->hwnd);
|
||||
|
||||
g_assert_not_reached (); /* Isn't sent any longer */
|
||||
|
||||
event->selection.type = GDK_SELECTION_NOTIFY;
|
||||
event->selection.window = window;
|
||||
@@ -3445,8 +3349,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
}
|
||||
else if (xevent->message == gdk_selection_request_msg)
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print ("gdk_selection_request_msg: %#x\n",
|
||||
(guint) xevent->hwnd));
|
||||
g_print ("gdk_selection_request_msg: %#x\n",
|
||||
(guint) xevent->hwnd);
|
||||
|
||||
g_assert_not_reached ();
|
||||
|
||||
event->selection.type = GDK_SELECTION_REQUEST;
|
||||
event->selection.window = window;
|
||||
@@ -3462,9 +3368,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
}
|
||||
else if (xevent->message == gdk_selection_clear_msg)
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print ("gdk_selection_clear_msg: %#x\n",
|
||||
(guint) xevent->hwnd));
|
||||
g_print ("gdk_selection_clear_msg: %#x\n",
|
||||
(guint) xevent->hwnd);
|
||||
|
||||
g_assert_not_reached ();
|
||||
event->selection.type = GDK_SELECTION_CLEAR;
|
||||
event->selection.window = window;
|
||||
event->selection.selection = xevent->wParam;
|
||||
@@ -3932,7 +3839,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
event->key.window = window;
|
||||
return_val = !GDK_DRAWABLE_DESTROYED (window);
|
||||
GDK_NOTE (EVENTS, (g_print (G_STRLOC ":event_mask: "), print_event_mask (GDK_WINDOW_WIN32DATA (window)->event_mask), g_print ("\n")));
|
||||
GDK_NOTE (EVENTS, g_print (G_STRLOC ":event_mask: %s\n", event_mask_string (GDK_WINDOW_WIN32DATA (window)->event_mask)));
|
||||
if (return_val && (event->key.window == k_grab_window
|
||||
|| (GDK_WINDOW_WIN32DATA (window)->event_mask & GDK_KEY_RELEASE_MASK)))
|
||||
{
|
||||
|
||||
@@ -40,6 +40,9 @@ GdkAtom gdk_win32_dropfiles_atom;
|
||||
GdkAtom gdk_ole2_dnd_atom;
|
||||
GdkAtom gdk_selection_property;
|
||||
GdkAtom text_uri_list_atom;
|
||||
GdkAtom compound_text_atom;
|
||||
gint gdk_null_window_warnings = TRUE;
|
||||
WORD cf_rtf;
|
||||
WORD cf_utf8_string;
|
||||
|
||||
DWORD windows_version = 0;
|
||||
|
||||
@@ -237,6 +237,69 @@ gdk_wcstombs (const GdkWChar *src)
|
||||
return mbstr;
|
||||
}
|
||||
|
||||
/* A vesion that converts from wchar_t wide char strings to UTF-8 */
|
||||
|
||||
gchar *
|
||||
gdk_nwchar_ts_to_mbs (const wchar_t *src,
|
||||
gint src_len)
|
||||
{
|
||||
gint len;
|
||||
const wchar_t *wcp;
|
||||
guchar *mbstr, *bp;
|
||||
|
||||
wcp = src;
|
||||
len = 0;
|
||||
while (wcp < src + src_len)
|
||||
{
|
||||
const wchar_t c = *wcp++;
|
||||
|
||||
if (c < 0x80)
|
||||
len += 1;
|
||||
else if (c < 0x800)
|
||||
len += 2;
|
||||
else
|
||||
len += 3;
|
||||
}
|
||||
|
||||
mbstr = g_malloc (len + 1);
|
||||
|
||||
wcp = src;
|
||||
bp = mbstr;
|
||||
while (wcp < src + src_len)
|
||||
{
|
||||
int first;
|
||||
wchar_t c = *wcp++;
|
||||
|
||||
if (c < 0x80)
|
||||
{
|
||||
first = 0;
|
||||
len = 1;
|
||||
}
|
||||
else if (c < 0x800)
|
||||
{
|
||||
first = 0xc0;
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = 0xe0;
|
||||
len = 3;
|
||||
}
|
||||
|
||||
/* Woo-hoo! */
|
||||
switch (len)
|
||||
{
|
||||
case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
|
||||
case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
|
||||
case 1: bp[0] = c | first;
|
||||
}
|
||||
|
||||
bp += len;
|
||||
}
|
||||
*bp = 0;
|
||||
|
||||
return mbstr;
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_mbstowcs
|
||||
|
||||
@@ -90,10 +90,14 @@ _gdk_windowing_init_check (int argc,
|
||||
|
||||
gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE);
|
||||
text_uri_list_atom = gdk_atom_intern ("text/uri-list", FALSE);
|
||||
compound_text_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
|
||||
gdk_clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
|
||||
gdk_win32_dropfiles_atom = gdk_atom_intern ("DROPFILES_DND", FALSE);
|
||||
gdk_ole2_dnd_atom = gdk_atom_intern ("OLE2_DND", FALSE);
|
||||
|
||||
cf_rtf = RegisterClipboardFormat ("Rich Text Format");
|
||||
cf_utf8_string = RegisterClipboardFormat ("UTF8_STRING");
|
||||
|
||||
gdk_win32_selection_init ();
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -430,6 +430,9 @@ gint gdk_nmbstowchar_ts (wchar_t *dest,
|
||||
gint src_len,
|
||||
gint dest_max);
|
||||
|
||||
gchar *gdk_nwchar_ts_to_mbs (const wchar_t *src,
|
||||
gint src_len);
|
||||
|
||||
void gdk_wchar_text_handle (GdkFont *font,
|
||||
const wchar_t *wcstr,
|
||||
int wclen,
|
||||
@@ -484,9 +487,12 @@ extern UINT gdk_selection_request_msg;
|
||||
extern UINT gdk_selection_clear_msg;
|
||||
GDKVAR GdkAtom gdk_selection_property;
|
||||
extern GdkAtom text_uri_list_atom;
|
||||
extern GdkAtom compound_text_atom;
|
||||
extern GdkAtom gdk_clipboard_atom;
|
||||
extern GdkAtom gdk_win32_dropfiles_atom;
|
||||
extern GdkAtom gdk_ole2_dnd_atom;
|
||||
extern WORD cf_rtf;
|
||||
extern WORD cf_utf8_string;
|
||||
|
||||
typedef enum {
|
||||
GDK_WIN32_DND_NONE = 0,
|
||||
|
||||
@@ -241,7 +241,6 @@ gdk_property_change (GdkWindow *window,
|
||||
const guchar *data,
|
||||
gint nelements)
|
||||
{
|
||||
static WORD cf_rtf = 0, cf_utf8_string = 0;
|
||||
HGLOBAL hdata, hlcid, hutf8;
|
||||
UINT cf = 0;
|
||||
LCID lcid;
|
||||
@@ -422,8 +421,6 @@ gdk_property_change (GdkWindow *window,
|
||||
break;
|
||||
|
||||
case RICH_TEXT:
|
||||
if (!cf_rtf)
|
||||
cf_rtf = RegisterClipboardFormat ("Rich Text Format");
|
||||
cf = cf_rtf;
|
||||
memmove (ucptr, rtf->str, size);
|
||||
g_string_free (rtf, TRUE);
|
||||
@@ -431,8 +428,6 @@ gdk_property_change (GdkWindow *window,
|
||||
/* Set the UTF8_STRING clipboard data, too, for other
|
||||
* GTK+ apps to use (won't bother reading RTF).
|
||||
*/
|
||||
if (cf_utf8_string == 0)
|
||||
cf_utf8_string = RegisterClipboardFormat ("UTF8_STRING");
|
||||
if (!(hutf8 = GlobalAlloc (GMEM_MOVEABLE, nelements)))
|
||||
WIN32_API_FAILED ("GlobalAlloc");
|
||||
else
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkwin32.h"
|
||||
@@ -112,8 +113,9 @@ gdk_selection_owner_set (GdkWindow *owner,
|
||||
guint32 time,
|
||||
gint send_event)
|
||||
{
|
||||
gchar *sel_name;
|
||||
HWND xwindow;
|
||||
GdkEvent tmp_event;
|
||||
gchar *sel_name;
|
||||
|
||||
GDK_NOTE (DND,
|
||||
(sel_name = gdk_atom_name (selection),
|
||||
@@ -122,10 +124,6 @@ gdk_selection_owner_set (GdkWindow *owner,
|
||||
(guint) selection, sel_name),
|
||||
g_free (sel_name)));
|
||||
|
||||
/* We don't support the PRIMARY selection */
|
||||
if (selection == GDK_SELECTION_PRIMARY)
|
||||
return FALSE;
|
||||
|
||||
if (selection != gdk_clipboard_atom)
|
||||
{
|
||||
if (owner != NULL)
|
||||
@@ -165,12 +163,21 @@ gdk_selection_owner_set (GdkWindow *owner,
|
||||
|
||||
if (owner != NULL)
|
||||
{
|
||||
/* Send ourselves an ersatz selection request message so that
|
||||
* gdk_property_change will be called to store the clipboard data.
|
||||
/* Send ourselves a selection request message so that
|
||||
* gdk_property_change will be called to store the clipboard
|
||||
* data.
|
||||
*/
|
||||
GDK_NOTE (DND, g_print ("...sending gdk_selection_request_msg to ourselves\n"));
|
||||
SendMessage (xwindow, gdk_selection_request_msg,
|
||||
selection, 0);
|
||||
GDK_NOTE (DND, g_print ("...sending GDK_SELECTION_REQUEST to ourselves\n"));
|
||||
tmp_event.selection.type = GDK_SELECTION_REQUEST;
|
||||
tmp_event.selection.window = owner;
|
||||
tmp_event.selection.send_event = FALSE;
|
||||
tmp_event.selection.selection = selection;
|
||||
tmp_event.selection.target = GDK_TARGET_STRING;
|
||||
tmp_event.selection.property = gdk_selection_property;
|
||||
tmp_event.selection.requestor = (guint32) xwindow;
|
||||
tmp_event.selection.time = time;
|
||||
|
||||
gdk_event_put (&tmp_event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -182,16 +189,13 @@ gdk_selection_owner_get (GdkAtom selection)
|
||||
GdkWindow *window;
|
||||
gchar *sel_name;
|
||||
|
||||
/* Return NULL for PRIMARY because we don't want to support that.
|
||||
*
|
||||
* Also return NULL for CLIPBOARD, because otherwise cut&paste
|
||||
/* Return NULL for CLIPBOARD, because otherwise cut&paste
|
||||
* inside the same application doesn't work. We must pretend to gtk
|
||||
* that we don't have the selection, so that we always fetch it from
|
||||
* the Windows clipboard. See also comments in
|
||||
* gdk_selection_send_notify().
|
||||
*/
|
||||
if (selection == GDK_SELECTION_PRIMARY ||
|
||||
selection == gdk_clipboard_atom)
|
||||
if (selection == gdk_clipboard_atom)
|
||||
return NULL;
|
||||
|
||||
window = gdk_window_lookup (g_hash_table_lookup (sel_owner_table, selection));
|
||||
@@ -206,6 +210,27 @@ gdk_selection_owner_get (GdkAtom selection)
|
||||
return window;
|
||||
}
|
||||
|
||||
static void
|
||||
generate_selection_notify (GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
guint32 time)
|
||||
{
|
||||
GdkEvent tmp_event;
|
||||
|
||||
tmp_event.selection.type = GDK_SELECTION_NOTIFY;
|
||||
tmp_event.selection.window = requestor;
|
||||
tmp_event.selection.send_event = FALSE;
|
||||
tmp_event.selection.selection = selection;
|
||||
tmp_event.selection.target = target;
|
||||
tmp_event.selection.property = property;
|
||||
tmp_event.selection.requestor = 0;
|
||||
tmp_event.selection.time = time;
|
||||
|
||||
gdk_event_put (&tmp_event);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_selection_convert (GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
@@ -213,9 +238,8 @@ gdk_selection_convert (GdkWindow *requestor,
|
||||
guint32 time)
|
||||
{
|
||||
HGLOBAL hdata;
|
||||
guchar *ptr, *data, *datap, *p;
|
||||
guint i, length, slength;
|
||||
gchar *sel_name, *tgt_name;
|
||||
GdkAtom property = gdk_selection_property;
|
||||
|
||||
g_return_if_fail (requestor != NULL);
|
||||
if (GDK_DRAWABLE_DESTROYED (requestor))
|
||||
@@ -231,7 +255,9 @@ gdk_selection_convert (GdkWindow *requestor,
|
||||
g_free (sel_name),
|
||||
g_free (tgt_name)));
|
||||
|
||||
if (selection == gdk_clipboard_atom)
|
||||
if (selection == gdk_clipboard_atom &&
|
||||
(target == compound_text_atom ||
|
||||
target == GDK_TARGET_STRING))
|
||||
{
|
||||
/* Converting the CLIPBOARD selection means he wants the
|
||||
* contents of the clipboard. Get the clipboard data,
|
||||
@@ -243,54 +269,132 @@ gdk_selection_convert (GdkWindow *requestor,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((hdata = GetClipboardData (CF_TEXT)) != NULL)
|
||||
/* Try various formats. First the simplest, CF_UNICODETEXT. */
|
||||
if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL)
|
||||
{
|
||||
wchar_t *ptr, *wcs, *p, *q;
|
||||
guchar *data;
|
||||
gint length, wclen;
|
||||
|
||||
if ((ptr = GlobalLock (hdata)) != NULL)
|
||||
{
|
||||
length = GlobalSize (hdata);
|
||||
|
||||
GDK_NOTE (DND, g_print ("...got data: %d bytes: %.10s\n",
|
||||
length, ptr));
|
||||
|
||||
slength = 0;
|
||||
GDK_NOTE (DND, g_print ("...CF_UNICODETEXT: %d bytes\n",
|
||||
length));
|
||||
|
||||
/* Strip out \r */
|
||||
wcs = g_new (wchar_t, (length + 1) * 2);
|
||||
p = ptr;
|
||||
for (i = 0; i < length; i++)
|
||||
q = wcs;
|
||||
wclen = 0;
|
||||
while (*p)
|
||||
{
|
||||
if (*p == '\0')
|
||||
break;
|
||||
else if (*p != '\r')
|
||||
slength++;
|
||||
if (*p != '\r')
|
||||
{
|
||||
*q++ = *p;
|
||||
wclen++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
data = gdk_nwchar_ts_to_mbs (wcs, wclen);
|
||||
g_free (wcs);
|
||||
|
||||
data = datap = g_malloc (slength + 1);
|
||||
p = ptr;
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (*p == '\0')
|
||||
break;
|
||||
else if (*p != '\r')
|
||||
*datap++ = *p;
|
||||
p++;
|
||||
}
|
||||
*datap++ = '\0';
|
||||
sel_prop_store (requestor, GDK_TARGET_STRING, 8,
|
||||
sel_prop_store (requestor, target, 8,
|
||||
data, strlen (data) + 1);
|
||||
GlobalUnlock (hdata);
|
||||
}
|
||||
}
|
||||
CloseClipboard ();
|
||||
else if ((hdata = GetClipboardData (cf_utf8_string)) != NULL)
|
||||
{
|
||||
/* UTF8_STRING is a format we store ourselves when necessary */
|
||||
guchar *ptr;
|
||||
gint length;
|
||||
|
||||
/* Send ourselves an ersatz selection notify message so that we actually
|
||||
* fetch the data.
|
||||
*/
|
||||
SendMessage (GDK_DRAWABLE_XID (requestor), gdk_selection_notify_msg, selection, target);
|
||||
if ((ptr = GlobalLock (hdata)) != NULL)
|
||||
{
|
||||
length = GlobalSize (hdata);
|
||||
|
||||
GDK_NOTE (DND, g_print ("...UTF8_STRING: %d bytes: %.10s\n",
|
||||
length, ptr));
|
||||
|
||||
sel_prop_store (requestor, target, 8,
|
||||
g_strdup (ptr), strlen (ptr) + 1);
|
||||
GlobalUnlock (hdata);
|
||||
}
|
||||
}
|
||||
else if ((hdata = GetClipboardData (CF_TEXT)) != NULL)
|
||||
{
|
||||
/* We must always assume the data can contain non-ASCII
|
||||
* in either the current code page, or if there is CF_LOCALE
|
||||
* data, in that locale's default code page.
|
||||
*/
|
||||
HGLOBAL hlcid;
|
||||
UINT cp = CP_ACP;
|
||||
wchar_t *wcs, *wcs2, *p, *q;
|
||||
guchar *ptr, *data;
|
||||
gint length, wclen;
|
||||
|
||||
if ((ptr = GlobalLock (hdata)) != NULL)
|
||||
{
|
||||
length = GlobalSize (hdata);
|
||||
|
||||
GDK_NOTE (DND, g_print ("...CF_TEXT: %d bytes: %.10s\n",
|
||||
length, ptr));
|
||||
|
||||
if ((hlcid = GetClipboardData (CF_LOCALE)) != NULL)
|
||||
{
|
||||
gchar buf[10];
|
||||
LCID *lcidptr = GlobalLock (hlcid);
|
||||
if (GetLocaleInfo (*lcidptr, LOCALE_IDEFAULTANSICODEPAGE,
|
||||
buf, sizeof (buf)))
|
||||
{
|
||||
cp = atoi (buf);
|
||||
GDK_NOTE (DND, g_print ("...CF_LOCALE: %#x cp:%d\n",
|
||||
*lcidptr, cp));
|
||||
}
|
||||
GlobalUnlock (hlcid);
|
||||
}
|
||||
|
||||
wcs = g_new (wchar_t, length + 1);
|
||||
wclen = MultiByteToWideChar (cp, 0, ptr, length,
|
||||
wcs, length + 1);
|
||||
|
||||
/* Strip out \r */
|
||||
wcs2 = g_new (wchar_t, wclen);
|
||||
p = wcs;
|
||||
q = wcs2;
|
||||
wclen = 0;
|
||||
while (*p)
|
||||
{
|
||||
if (*p != '\r')
|
||||
{
|
||||
*q++ = *p;
|
||||
wclen++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
g_free (wcs);
|
||||
|
||||
data = gdk_nwchar_ts_to_mbs (wcs2, wclen);
|
||||
g_free (wcs2);
|
||||
|
||||
sel_prop_store (requestor, target, 8,
|
||||
data, strlen (data) + 1);
|
||||
GlobalUnlock (hdata);
|
||||
}
|
||||
}
|
||||
else
|
||||
property = GDK_NONE;
|
||||
|
||||
CloseClipboard ();
|
||||
}
|
||||
else if (selection == gdk_win32_dropfiles_atom)
|
||||
{
|
||||
/* This means he wants the names of the dropped files.
|
||||
* gdk_dropfiles_filter already has stored the text/uri-list
|
||||
* data tempoarily in dropfiles_prop.
|
||||
* data temporarily in dropfiles_prop.
|
||||
*/
|
||||
if (dropfiles_prop != NULL)
|
||||
{
|
||||
@@ -298,13 +402,14 @@ gdk_selection_convert (GdkWindow *requestor,
|
||||
dropfiles_prop->data, dropfiles_prop->length);
|
||||
g_free (dropfiles_prop);
|
||||
dropfiles_prop = NULL;
|
||||
SendMessage (GDK_DRAWABLE_XID (requestor), gdk_selection_notify_msg, selection, target);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("gdk_selection_convert: General case not implemented");
|
||||
}
|
||||
|
||||
/* Generate a selection notify message so that we actually fetch
|
||||
* the data (if property == gdk_selection_property) or indicating failure
|
||||
* (if property == GDK_NONE).
|
||||
*/
|
||||
generate_selection_notify (requestor, selection, target, property, time);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -368,6 +473,7 @@ gdk_selection_send_notify (guint32 requestor,
|
||||
GdkAtom property,
|
||||
guint32 time)
|
||||
{
|
||||
GdkEvent tmp_event;
|
||||
gchar *sel_name, *tgt_name, *prop_name;
|
||||
|
||||
GDK_NOTE (DND,
|
||||
@@ -397,7 +503,16 @@ gdk_selection_send_notify (guint32 requestor,
|
||||
* return NULL for CLIPBOARD, it works. Sigh.
|
||||
*/
|
||||
|
||||
SendMessage ((HWND) requestor, gdk_selection_clear_msg, selection, target);
|
||||
tmp_event.selection.type = GDK_SELECTION_CLEAR;
|
||||
tmp_event.selection.window = gdk_window_lookup (requestor);
|
||||
tmp_event.selection.send_event = FALSE;
|
||||
tmp_event.selection.selection = selection;
|
||||
tmp_event.selection.target = 0;
|
||||
tmp_event.selection.property = 0;
|
||||
tmp_event.selection.requestor = 0;
|
||||
tmp_event.selection.time = time;
|
||||
|
||||
gdk_event_put (&tmp_event);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -407,9 +522,20 @@ gdk_text_property_to_text_list (GdkAtom encoding,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("gdk_text_property_to_text_list not implemented\n"));
|
||||
gchar *enc_name;
|
||||
|
||||
GDK_NOTE (DND, (enc_name = gdk_atom_name (encoding),
|
||||
g_print ("gdk_text_property_to_text_list: %s %d %.20s %d\n",
|
||||
enc_name, format, text, length),
|
||||
g_free (enc_name)));
|
||||
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
*list = g_new (gchar **, 1);
|
||||
**list = g_strdup (text);
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -417,7 +543,8 @@ gdk_free_text_list (gchar **list)
|
||||
{
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
/* ??? */
|
||||
g_free (*list);
|
||||
g_free (list);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -427,7 +554,19 @@ gdk_string_to_compound_text (const gchar *str,
|
||||
guchar **ctext,
|
||||
gint *length)
|
||||
{
|
||||
g_warning ("gdk_string_to_compound_text: Not implemented");
|
||||
GDK_NOTE (DND, g_print ("gdk_string_to_compound_text: %.20s\n", str));
|
||||
|
||||
if (encoding)
|
||||
*encoding = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
|
||||
|
||||
if (format)
|
||||
*format = 8;
|
||||
|
||||
if (ctext)
|
||||
*ctext = g_strdup (str);
|
||||
|
||||
if (length)
|
||||
*length = strlen (str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -435,5 +574,5 @@ gdk_string_to_compound_text (const gchar *str,
|
||||
void
|
||||
gdk_free_compound_text (guchar *ctext)
|
||||
{
|
||||
g_warning ("gdk_free_compound_text: Not implemented");
|
||||
g_free (ctext);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user