void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, EventTarget* relatedTarget, unsigned short buttons) { if (isBeingDispatched()) return; if (scriptState && scriptState->world().isIsolatedWorld()) UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shiftKey, metaKey); initModifiers(ctrlKey, altKey, shiftKey, metaKey); initMouseEventInternal(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, modifiers(), button, relatedTarget, nullptr, buttons); }
void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) { if (dispatched()) return; if (scriptState->world().isIsolatedWorld()) UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shiftKey, metaKey); initUIEvent(type, canBubble, cancelable, view, 0); m_keyIdentifier = keyIdentifier; m_location = location; initModifiers(ctrlKey, altKey, shiftKey, metaKey); initLocationModifiers(location); }
void icon_set_shortcut(Icon *icon, const gchar *shortcut) { g_return_if_fail(icon != NULL); if (shortcut && !*shortcut) shortcut = NULL; if (icon->shortcut == shortcut) return; if (icon->shortcut && shortcut && strcmp(icon->shortcut, shortcut) == 0) return; initModifiers(); ungrab_key(icon); g_free(icon->shortcut); icon->shortcut = g_strdup(shortcut); parseKeyString(&icon->shortcut_key, shortcut); grab_key(icon); }
static GdkFilterReturn filter_get_key(GdkXEvent *xevent, GdkEvent *event, gpointer data) { XKeyEvent *kev = (XKeyEvent *) xevent; GtkWidget *popup = (GtkWidget *) data; Display *dpy = GDK_DISPLAY(); if (kev->type != KeyRelease && kev->type != ButtonPressMask) return GDK_FILTER_CONTINUE; initModifiers(); if (kev->type == KeyRelease) { gchar *str; KeySym sym; unsigned int m = kev->state; sym = XKeycodeToKeysym(dpy, kev->keycode, 0); if (!sym) return GDK_FILTER_CONTINUE; str = g_strdup_printf("%s%s%s%s%s%s%s", m & ControlMask ? "Control+" : "", m & ShiftMask ? "Shift+" : "", m & AltMask ? "Alt+" : "", m & MetaMask ? "Meta+" : "", m & SuperMask ? "Super+" : "", m & HyperMask ? "Hyper+" : "", XKeysymToString(sym)); g_object_set_data(G_OBJECT(popup), "chosen-key", str); } gdk_window_remove_filter(popup->window, filter_get_key, data); gtk_widget_destroy(popup); return GDK_FILTER_REMOVE; }