quartz: consumed modifiers of key presses, clicks on the title bar, page up and down, Escape in input methods, the clipboard owner and clearing the drag pasteboard fixed as in GTK+ 3
This commit is contained in:
parent
e6c754e1f6
commit
d9ba173bf3
6 changed files with 81 additions and 27 deletions
|
|
@ -530,6 +530,20 @@
|
|||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)scrollPageDown: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_message ("scrollPageDown"));
|
||||
g_object_set_data (G_OBJECT (gdk_window), GIC_FILTER_KEY,
|
||||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)scrollPageUp: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_message ("scrollPageUp"));
|
||||
g_object_set_data (G_OBJECT (gdk_window), GIC_FILTER_KEY,
|
||||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)selectAll: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print ("selectAll\n"));
|
||||
|
|
|
|||
|
|
@ -551,6 +551,29 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
|
|||
* here, not very nice.
|
||||
*/
|
||||
_gdk_quartz_events_break_all_grabs (get_time_from_ns_event (nsevent));
|
||||
|
||||
/* Check if the event occurred on the titlebar. If it did,
|
||||
* explicitly return NULL to prevent going through the
|
||||
* fallback path, which could match the window that is
|
||||
* directly under the titlebar.
|
||||
*/
|
||||
if (view_point.y < 0 &&
|
||||
view_point.x >= view_frame.origin.x &&
|
||||
view_point.x < view_frame.origin.x + view_frame.size.width)
|
||||
{
|
||||
NSView *superview = [view superview];
|
||||
if (superview)
|
||||
{
|
||||
NSRect superview_frame = [superview frame];
|
||||
int titlebar_height = superview_frame.size.height -
|
||||
view_frame.size.height;
|
||||
|
||||
if (titlebar_height > 0 && view_point.y >= -titlebar_height)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -470,7 +470,8 @@ update_keymap (void)
|
|||
p[0] = known_numeric_keys[i].keypad_keyval;
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (default_keymap, "keys-changed");
|
||||
if (default_keymap != NULL)
|
||||
g_signal_emit_by_name (default_keymap, "keys-changed");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -696,7 +697,6 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
|||
{
|
||||
guint tmp_keyval;
|
||||
GdkModifierType bit;
|
||||
guint tmp_modifiers = 0;
|
||||
|
||||
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
||||
g_return_val_if_fail (group >= 0 && group <= 1, FALSE);
|
||||
|
|
@ -716,24 +716,23 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
|||
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
|
||||
return FALSE;
|
||||
|
||||
/* Check if modifiers modify the keyval */
|
||||
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
||||
{
|
||||
if (translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 0 : group,
|
||||
state & ~bit,
|
||||
NULL, NULL) !=
|
||||
translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 1 : group,
|
||||
state | bit,
|
||||
NULL, NULL))
|
||||
tmp_modifiers |= bit;
|
||||
}
|
||||
|
||||
tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
|
||||
|
||||
/* Check if modifiers modify the keyval */
|
||||
if (consumed_modifiers)
|
||||
*consumed_modifiers = tmp_modifiers;
|
||||
{
|
||||
guint tmp_modifiers = (state & GDK_MODIFIER_MASK);
|
||||
|
||||
for (bit = 1; bit <= tmp_modifiers; bit <<= 1)
|
||||
{
|
||||
if ((bit & tmp_modifiers) &&
|
||||
translate_keysym (hardware_keycode, group, state & ~bit,
|
||||
NULL, NULL) == tmp_keyval)
|
||||
tmp_modifiers &= ~bit;
|
||||
}
|
||||
|
||||
*consumed_modifiers = tmp_modifiers;
|
||||
}
|
||||
|
||||
if (keyval)
|
||||
*keyval = tmp_keyval;
|
||||
|
|
|
|||
|
|
@ -335,7 +335,6 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
|
|||
gpointer user_data,
|
||||
gboolean have_owner)
|
||||
{
|
||||
GtkClipboardOwner *owner;
|
||||
NSSet *types;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
|
|
@ -371,26 +370,35 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
|
|||
*/
|
||||
if (user_data && user_data == clipboard->user_data)
|
||||
{
|
||||
owner = [clipboard->owner retain];
|
||||
|
||||
owner->setting_same_owner = TRUE;
|
||||
clipboard->owner->setting_same_owner = TRUE;
|
||||
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
|
||||
owner: owner];
|
||||
owner->setting_same_owner = FALSE;
|
||||
owner: clipboard->owner];
|
||||
clipboard->owner->setting_same_owner = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
|
||||
GtkClipboardOwner *new_owner;
|
||||
|
||||
/* We do not set the new owner on clipboard->owner immediately,
|
||||
* because declareTypes could (but not always does -- see also the
|
||||
* comment at pasteboardChangedOwner above) cause clipboard_unset
|
||||
* to be called, which releases clipboard->owner.
|
||||
*/
|
||||
new_owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
|
||||
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
|
||||
owner: owner];
|
||||
owner: new_owner];
|
||||
|
||||
/* In case pasteboardChangedOwner was not triggered, check to see
|
||||
* whether the previous owner still needs to be released.
|
||||
*/
|
||||
if (clipboard->owner)
|
||||
[clipboard->owner release];
|
||||
clipboard->owner = new_owner;
|
||||
}
|
||||
|
||||
[owner release];
|
||||
[types release];
|
||||
[pool release];
|
||||
|
||||
clipboard->owner = owner;
|
||||
clipboard->user_data = user_data;
|
||||
clipboard->have_owner = have_owner;
|
||||
if (have_owner)
|
||||
|
|
@ -480,6 +488,8 @@ clipboard_unset (GtkClipboard *clipboard)
|
|||
g_free (clipboard->storable_targets);
|
||||
clipboard->storable_targets = NULL;
|
||||
|
||||
if (clipboard->owner)
|
||||
[clipboard->owner release];
|
||||
clipboard->owner = NULL;
|
||||
clipboard->get_func = NULL;
|
||||
clipboard->clear_func = NULL;
|
||||
|
|
|
|||
|
|
@ -1955,7 +1955,12 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info)
|
|||
* info->context after it has been destroyed.
|
||||
*/
|
||||
pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard];
|
||||
[pasteboard declareTypes: nil owner: nil];
|
||||
/* clearContents is there from 10.6 on; declareTypes with nil no longer
|
||||
* builds with newer SDKs */
|
||||
if ([pasteboard respondsToSelector: @selector(clearContents)])
|
||||
[pasteboard performSelector: @selector(clearContents)];
|
||||
else
|
||||
[pasteboard declareTypes: [NSArray array] owner: nil];
|
||||
|
||||
[pool release];
|
||||
|
||||
|
|
|
|||
|
|
@ -219,6 +219,9 @@ quartz_filter_keypress (GtkIMContext *context,
|
|||
if (event->hardware_keycode == 55) /* Command */
|
||||
return FALSE;
|
||||
|
||||
if (event->hardware_keycode == 53) /* Escape */
|
||||
return FALSE;
|
||||
|
||||
NSEventType etype = [nsevent type];
|
||||
if (etype == NSKeyDown)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue