📄 gdkevents.c
字号:
event->key.keyval); if (charcount > 0) g_message ("\t\tlength: %4d string: \"%s\"", charcount, buf); }#endif /* G_ENABLE_DEBUG */ event->key.type = GDK_KEY_PRESS; event->key.window = window; event->key.time = xevent->xkey.time; event->key.state = (GdkModifierType) xevent->xkey.state; event->key.string = g_strdup (buf); event->key.length = charcount; break; case KeyRelease: /* Lookup the string corresponding to the given keysym. */#ifdef USE_XIM if (buf_len == 0) { buf_len = 128; buf = g_new (gchar, buf_len); }#endif keysym = GDK_VoidSymbol; charcount = XLookupString (&xevent->xkey, buf, 16, &keysym, &compose); event->key.keyval = keysym; /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("key release:\t\twindow: %ld key: %12s %d", xevent->xkey.window, XKeysymToString (event->key.keyval), event->key.keyval)); event->key.type = GDK_KEY_RELEASE; event->key.window = window; event->key.time = xevent->xkey.time; event->key.state = (GdkModifierType) xevent->xkey.state; event->key.length = 0; event->key.string = NULL; break; case ButtonPress: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("button press:\t\twindow: %ld x,y: %d %d button: %d", xevent->xbutton.window, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button)); if (window_private && (window_private->extension_events != 0) && gdk_input_ignore_core) { return_val = FALSE; break; } event->button.type = GDK_BUTTON_PRESS; event->button.window = window; event->button.time = xevent->xbutton.time; event->button.x = xevent->xbutton.x; event->button.y = xevent->xbutton.y; event->button.x_root = (gfloat)xevent->xbutton.x_root; event->button.y_root = (gfloat)xevent->xbutton.y_root; event->button.pressure = 0.5; event->button.xtilt = 0; event->button.ytilt = 0; event->button.state = (GdkModifierType) xevent->xbutton.state; event->button.button = xevent->xbutton.button; event->button.source = GDK_SOURCE_MOUSE; event->button.deviceid = GDK_CORE_POINTER; if ((event->button.time < (button_click_time[1] + TRIPLE_CLICK_TIME)) && (event->button.window == button_window[1]) && (event->button.button == button_number[1])) { gdk_synthesize_click (event, 3); button_click_time[1] = 0; button_click_time[0] = 0; button_window[1] = NULL; button_window[0] = 0; button_number[1] = -1; button_number[0] = -1; } else if ((event->button.time < (button_click_time[0] + DOUBLE_CLICK_TIME)) && (event->button.window == button_window[0]) && (event->button.button == button_number[0])) { gdk_synthesize_click (event, 2); button_click_time[1] = button_click_time[0]; button_click_time[0] = event->button.time; button_window[1] = button_window[0]; button_window[0] = event->button.window; button_number[1] = button_number[0]; button_number[0] = event->button.button; } else { button_click_time[1] = 0; button_click_time[0] = event->button.time; button_window[1] = NULL; button_window[0] = event->button.window; button_number[1] = -1; button_number[0] = event->button.button; } break; case ButtonRelease: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("button release:\twindow: %ld x,y: %d %d button: %d", xevent->xbutton.window, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button)); if (window_private && (window_private->extension_events != 0) && gdk_input_ignore_core) { return_val = FALSE; break; } event->button.type = GDK_BUTTON_RELEASE; event->button.window = window; event->button.time = xevent->xbutton.time; event->button.x = xevent->xbutton.x; event->button.y = xevent->xbutton.y; event->button.x_root = (gfloat)xevent->xbutton.x_root; event->button.y_root = (gfloat)xevent->xbutton.y_root; event->button.pressure = 0.5; event->button.xtilt = 0; event->button.ytilt = 0; event->button.state = (GdkModifierType) xevent->xbutton.state; event->button.button = xevent->xbutton.button; event->button.source = GDK_SOURCE_MOUSE; event->button.deviceid = GDK_CORE_POINTER; break; case MotionNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s", xevent->xmotion.window, xevent->xmotion.x, xevent->xmotion.y, (xevent->xmotion.is_hint) ? "true" : "false")); if (window_private && (window_private->extension_events != 0) && gdk_input_ignore_core) { return_val = FALSE; break; } event->motion.type = GDK_MOTION_NOTIFY; event->motion.window = window; event->motion.time = xevent->xmotion.time; event->motion.x = xevent->xmotion.x; event->motion.y = xevent->xmotion.y; event->motion.x_root = (gfloat)xevent->xmotion.x_root; event->motion.y_root = (gfloat)xevent->xmotion.y_root; event->motion.pressure = 0.5; event->motion.xtilt = 0; event->motion.ytilt = 0; event->motion.state = (GdkModifierType) xevent->xmotion.state; event->motion.is_hint = xevent->xmotion.is_hint; event->motion.source = GDK_SOURCE_MOUSE; event->motion.deviceid = GDK_CORE_POINTER; break; case EnterNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("enter notify:\t\twindow: %ld detail: %d subwin: %ld", xevent->xcrossing.window, xevent->xcrossing.detail, xevent->xcrossing.subwindow)); /* Tell XInput stuff about it if appropriate */ if (window_private && !window_private->destroyed && (window_private->extension_events != 0) && gdk_input_vtable.enter_event) gdk_input_vtable.enter_event (&xevent->xcrossing, window); event->crossing.type = GDK_ENTER_NOTIFY; event->crossing.window = window; /* If the subwindow field of the XEvent is non-NULL, then * lookup the corresponding GdkWindow. */ if (xevent->xcrossing.subwindow != None) event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow); else event->crossing.subwindow = NULL; event->crossing.time = xevent->xcrossing.time; event->crossing.x = xevent->xcrossing.x; event->crossing.y = xevent->xcrossing.y; event->crossing.x_root = xevent->xcrossing.x_root; event->crossing.y_root = xevent->xcrossing.y_root; /* Translate the crossing mode into Gdk terms. */ switch (xevent->xcrossing.mode) { case NotifyNormal: event->crossing.mode = GDK_CROSSING_NORMAL; break; case NotifyGrab: event->crossing.mode = GDK_CROSSING_GRAB; break; case NotifyUngrab: event->crossing.mode = GDK_CROSSING_UNGRAB; break; }; /* Translate the crossing detail into Gdk terms. */ switch (xevent->xcrossing.detail) { case NotifyInferior: event->crossing.detail = GDK_NOTIFY_INFERIOR; break; case NotifyAncestor: event->crossing.detail = GDK_NOTIFY_ANCESTOR; break; case NotifyVirtual: event->crossing.detail = GDK_NOTIFY_VIRTUAL; break; case NotifyNonlinear: event->crossing.detail = GDK_NOTIFY_NONLINEAR; break; case NotifyNonlinearVirtual: event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL; break; default: event->crossing.detail = GDK_NOTIFY_UNKNOWN; break; } event->crossing.focus = xevent->xcrossing.focus; event->crossing.state = xevent->xcrossing.state; break; case LeaveNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("leave notify:\t\twindow: %ld detail: %d subwin: %ld", xevent->xcrossing.window, xevent->xcrossing.detail, xevent->xcrossing.subwindow)); event->crossing.type = GDK_LEAVE_NOTIFY; event->crossing.window = window; /* If the subwindow field of the XEvent is non-NULL, then * lookup the corresponding GdkWindow. */ if (xevent->xcrossing.subwindow != None) event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow); else event->crossing.subwindow = NULL; event->crossing.time = xevent->xcrossing.time; event->crossing.x = xevent->xcrossing.x; event->crossing.y = xevent->xcrossing.y; event->crossing.x_root = xevent->xcrossing.x_root; event->crossing.y_root = xevent->xcrossing.y_root; /* Translate the crossing mode into Gdk terms. */ switch (xevent->xcrossing.mode) { case NotifyNormal: event->crossing.mode = GDK_CROSSING_NORMAL; break; case NotifyGrab: event->crossing.mode = GDK_CROSSING_GRAB; break; case NotifyUngrab: event->crossing.mode = GDK_CROSSING_UNGRAB; break; }; /* Translate the crossing detail into Gdk terms. */ switch (xevent->xcrossing.detail) { case NotifyInferior: event->crossing.detail = GDK_NOTIFY_INFERIOR; break; case NotifyAncestor: event->crossing.detail = GDK_NOTIFY_ANCESTOR; break; case NotifyVirtual: event->crossing.detail = GDK_NOTIFY_VIRTUAL; break; case NotifyNonlinear: event->crossing.detail = GDK_NOTIFY_NONLINEAR; break; case NotifyNonlinearVirtual: event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL; break; default: event->crossing.detail = GDK_NOTIFY_UNKNOWN; break; } event->crossing.focus = xevent->xcrossing.focus; event->crossing.state = xevent->xcrossing.state; break; case FocusIn: case FocusOut: /* We only care about focus events that indicate that _this_ * window (not a ancestor or child) got or lost the focus */ switch (xevent->xfocus.detail) { case NotifyAncestor: case NotifyInferior: case NotifyNonlinear: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("focus %s:\t\twindow: %ld", (xevent->xany.type == FocusIn) ? "in" : "out", xevent->xfocus.window)); /* gdk_keyboard_grab() causes following events. These events confuse * the XIM focus, so ignore them. */ if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) break; event->focus_change.type = GDK_FOCUS_CHANGE; event->focus_change.window = window; event->focus_change.in = (xevent->xany.type == FocusIn); break; default: return_val = FALSE; } break; case KeymapNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("keymap notify")); /* Not currently handled */ return_val = FALSE; break; case Expose: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d%s", xevent->xexpose.window, xevent->xexpose.count, xevent->xexpose.x, xevent->xexpose.y, xevent->xexpose.width, xevent->xexpose.height, event->any.send_event ? " (send)" : "")); gdk_compress_exposures (xevent, window); event->expose.type = GDK_EXPOSE; event->expose.window = window; event->expose.area.x = xevent->xexpose.x; event->expose.area.y = xevent->xexpose.y; event->expose.area.width = xevent->xexpose.width; event->expose.area.height = xevent->xexpose.height; event->expose.count = xevent->xexpose.count; break; case GraphicsExpose: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("graphics expose:\tdrawable: %ld", xevent->xgraphicsexpose.drawable)); event->expose.type = GDK_EXPOSE; event->expose.window = window; event->expose.area.x = xevent->xgraphicsexpose.x; event->expose.area.y = xevent->xgraphicsexpose.y; event->expose.area.width = xevent->xgraphicsexpose.width; event->expose.area.height = xevent->xgraphicsexpose.height; event->expose.count = xevent->xexpose.count; break; case NoExpose: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("no expose:\t\tdrawable: %ld", xevent->xnoexpose.drawable)); event->no_expose.type = GDK_NO_EXPOSE; event->no_expose.window = window; break; case VisibilityNotify: /* Print debugging info. */#ifdef G_ENABLE_DEBUG if (gdk_debug_flags & GDK_DEBUG_EVENTS) switch (xevent->xvisibility.state) { case VisibilityFullyObscured: g_message ("visibility notify:\twindow: %ld none", xevent->xvisibility.window); break; case VisibilityPartiallyObscured: g_message ("visibility notify:\twindow: %ld partial", xevent->xvisibility.window); break; case VisibilityUnobscured: g_message ("visibility notify:\twindow: %ld full", xevent->xvisibility.window); break; }#endif /* G_ENABLE_DEBUG */ event->visibility.type = GDK_VISIBILITY_NOTIFY; event->visibility.window = window; switch (xevent->xvisibility.state) { case VisibilityFullyObscured: event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED; break; case VisibilityPartiallyObscured: event->visibility.state = GDK_VISIBILITY_PARTIAL; break; case VisibilityUnobscured: event->visibility.state = GDK_VISIBILITY_UNOBSCURED; break; } break; case CreateNotify: GDK_NOTE (EVENTS, g_message ("create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d", xevent->xcreatewindow.window, xevent->xcreatewindow.x, xevent->xcreatewindow.y, xevent->xcreatewindow.width, xevent->xcreatewindow.height, xevent->xcreatewindow.border_width, xevent->xcreatewindow.parent, xevent->xcreatewindow.override_redirect)); /* not really handled */ break; case DestroyNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("destroy notify:\twindow: %ld", xevent->xdestroywindow.window)); event->any.type = GDK_DESTROY; event->any.window = window; return_val = window_private && !window_private->destroyed; if (window && window_private->xwindow != GDK_ROOT_WINDOW()) gdk_window_destroy_notify (window); break; case UnmapNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("unmap notify:\t\twindow: %ld", xevent->xmap.window)); event->any.type = GDK_UNMAP; event->any.window = window; if (gdk_xgrab_window == window_private) gdk_xgrab_window = NULL; break; case MapNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("map notify:\t\twindow: %ld", xevent->xmap.window)); event->any.type = GDK_MAP; event->any.window = window; break; case ReparentNotify: /* Print debugging info. */ GDK_NOTE (EVENTS, g_message ("reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d", xevent->xreparent.window, xevent->xreparent.x, xevent->xreparent.y, xevent->xreparent.parent, xevent->xreparent.override_redirect)); /* Not currently handled */ return_val = FALSE; break; case ConfigureNotify: /* Print debugging info. */ while (0 && /* don't reorder ConfigureNotify events at all */ XPending (gdk_display) > 0 && XCheckTypedWindowEvent (gdk_display, xevent->xany.window, ConfigureNotify, xevent)) { GdkFilterReturn result; GDK_NOTE (EVENTS, g_message ("configure notify discarded:\twindow: %ld", xevent->xconfigure.window)); result = gdk_event_apply_filters (xevent, event, window_private ?window_private->filters :gdk_default_filters); /* If the result is GDK_FILTER_REMOVE, there will be * trouble, but anybody who filtering the Configure events * better know what they are doing */ if (result != GDK_FILTER_CONTINUE) { return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; } /*XSync (gdk_display, 0);*/ }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -