📄 gdkevents-x11.c
字号:
gboolean had_focus = HAS_FOCUS (toplevel); switch (xevent->xfocus.detail) { case NotifyAncestor: case NotifyVirtual: /* When the focus moves from an ancestor of the window to * the window or a descendent of the window, *and* the * pointer is inside the window, then we were previously * receiving keystroke events in the has_pointer_focus * case and are now receiving them in the * has_focus_window case. */ if (toplevel->has_pointer && xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_pointer_focus = FALSE; /* fall through */ case NotifyNonlinear: case NotifyNonlinearVirtual: if (xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_focus_window = TRUE; /* We pretend that the focus moves to the grab * window, so we pay attention to NotifyGrab * NotifyUngrab, and ignore NotifyWhileGrabbed */ if (xevent->xfocus.mode != NotifyWhileGrabbed) toplevel->has_focus = TRUE; break; case NotifyPointer: /* The X server sends NotifyPointer/NotifyGrab, * but the pointer focus is ignored while a * grab is in effect */ if (xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_pointer_focus = TRUE; break; case NotifyInferior: case NotifyPointerRoot: case NotifyDetailNone: break; } if (HAS_FOCUS (toplevel) != had_focus) generate_focus_event (window, TRUE); } break; case FocusOut: GDK_NOTE (EVENTS, g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", xevent->xfocus.window, notify_details[xevent->xfocus.detail], notify_modes[xevent->xfocus.mode])); if (toplevel) { gboolean had_focus = HAS_FOCUS (toplevel); switch (xevent->xfocus.detail) { case NotifyAncestor: case NotifyVirtual: /* When the focus moves from the window or a descendent * of the window to an ancestor of the window, *and* the * pointer is inside the window, then we were previously * receiving keystroke events in the has_focus_window * case and are now receiving them in the * has_pointer_focus case. */ if (toplevel->has_pointer && xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_pointer_focus = TRUE; /* fall through */ case NotifyNonlinear: case NotifyNonlinearVirtual: if (xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_focus_window = FALSE; if (xevent->xfocus.mode != NotifyWhileGrabbed) toplevel->has_focus = FALSE; break; case NotifyPointer: if (xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyUngrab) toplevel->has_pointer_focus = FALSE; break; case NotifyInferior: case NotifyPointerRoot: case NotifyDetailNone: break; } if (HAS_FOCUS (toplevel) != had_focus) generate_focus_event (window, FALSE); } break;#if 0 /* 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;#endif case KeymapNotify: GDK_NOTE (EVENTS, g_message ("keymap notify")); /* Not currently handled */ return_val = FALSE; break; case Expose: 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)" : "")); if (window_private == NULL) { return_val = FALSE; break; } { GdkRectangle expose_rect; expose_rect.x = xevent->xexpose.x + xoffset; expose_rect.y = xevent->xexpose.y + yoffset; expose_rect.width = xevent->xexpose.width; expose_rect.height = xevent->xexpose.height; if (return_exposes) { event->expose.type = GDK_EXPOSE; event->expose.area = expose_rect; event->expose.region = gdk_region_rectangle (&expose_rect); event->expose.window = window; event->expose.count = xevent->xexpose.count; return_val = TRUE; } else { _gdk_window_process_expose (window, xevent->xexpose.serial, &expose_rect); return_val = FALSE; } return_val = FALSE; } break; case GraphicsExpose: { GdkRectangle expose_rect; GDK_NOTE (EVENTS, g_message ("graphics expose:\tdrawable: %ld", xevent->xgraphicsexpose.drawable)); if (window_private == NULL) { return_val = FALSE; break; } expose_rect.x = xevent->xgraphicsexpose.x + xoffset; expose_rect.y = xevent->xgraphicsexpose.y + yoffset; expose_rect.width = xevent->xgraphicsexpose.width; expose_rect.height = xevent->xgraphicsexpose.height; if (return_exposes) { event->expose.type = GDK_EXPOSE; event->expose.area = expose_rect; event->expose.region = gdk_region_rectangle (&expose_rect); event->expose.window = window; event->expose.count = xevent->xgraphicsexpose.count; return_val = TRUE; } else { _gdk_window_process_expose (window, xevent->xgraphicsexpose.serial, &expose_rect); return_val = FALSE; } } break; case NoExpose: 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:#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 */ if (window_private == NULL) { return_val = FALSE; break; } 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: GDK_NOTE (EVENTS, g_message ("destroy notify:\twindow: %ld", xevent->xdestroywindow.window)); /* Ignore DestroyNotify from SubstructureNotifyMask */ if (xevent->xdestroywindow.window == xevent->xdestroywindow.event) { event->any.type = GDK_DESTROY; event->any.window = window; return_val = window_private && !GDK_WINDOW_DESTROYED (window); if (window && GDK_WINDOW_XID (window) != screen_x11->xroot_window) gdk_window_destroy_notify (window); } else return_val = FALSE; break; case UnmapNotify: GDK_NOTE (EVENTS, g_message ("unmap notify:\t\twindow: %ld", xevent->xmap.window)); event->any.type = GDK_UNMAP; event->any.window = window; /* If we are shown (not withdrawn) and get an unmap, it means we * were iconified in the X sense. If we are withdrawn, and get * an unmap, it means we hid the window ourselves, so we * will have already flipped the iconified bit off. */ if (window) { if (GDK_WINDOW_IS_MAPPED (window)) gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_ICONIFIED); _gdk_xgrab_check_unmap (window, xevent->xany.serial); } break; case MapNotify: GDK_NOTE (EVENTS, g_message ("map notify:\t\twindow: %ld", xevent->xmap.window)); event->any.type = GDK_MAP; event->any.window = window; /* Unset iconified if it was set */ if (window && (((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_ICONIFIED)) gdk_synthesize_window_state (window, GDK_WINDOW_STATE_ICONIFIED, 0); break; case ReparentNotify: 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: GDK_NOTE (EVENTS, g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s", xevent->xconfigure.window, xevent->xconfigure.x, xevent->xconfigure.y, xevent->xconfigure.width, xevent->xconfigure.height, xevent->xconfigure.border_width, xevent->xconfigure.above, xevent->xconfigure.override_redirect, !window ? " (discarding)" : GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ? " (discarding child)" : xevent->xconfigure.event != xevent->xconfigure.window ? " (discarding substructure)" : "")); if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT) _gdk_x11_screen_size_changed (screen, xevent); if (window && xevent->xconfigure.event == xevent->xconfigure.window && !GDK_WINDOW_DESTROYED (window) && (window_private->extension_events != 0)) _gdk_input_configure_event (&xevent->xconfigure, window); #ifdef HAVE_XSYNC if (toplevel && display_x11->use_sync && !XSyncValueIsZero (toplevel->pending_counter_value)) { toplevel->current_counter_value = toplevel->pending_counter_value; XSyncIntToValue (&toplevel->pending_counter_value, 0); }#endif if (!window || xevent->xconfigure.event != xevent->xconfigure.window || GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD || GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT) return_val = FALSE; else { event->configure.type = GDK_CONFIGURE; event->configure.window = window; event->configure.width = xevent->xconfigure.width; event->configure.height = xevent->xconfigure.height; if (!xevent->xconfigure.send_event && !xevent->xconfigure.override_redirect && !GDK_WINDOW_DESTROYED (window)) { gint tx = 0; gint ty = 0; Window child_window = 0; gdk_error_trap_push (); if (XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window), screen_x11->xroot_window, 0, 0, &tx, &ty, &child_window)) { event->configure.x = tx; event->configure.y = ty; } gdk_error_trap_pop (); } else { event->configure.x = xevent->xconfigure.x; event->configure.y = xevent->xconfigure.y; } window_private->x = event->configure.x; window_private->y = event->configure.y; window_impl->width = xevent->xconfigure.width; window_impl->height = xevent->xconfigure.height; if (window_private->resize_count >= 1) { window_private->resize_count -= 1; if (window_private->resize_count == 0) _gdk_moveresize_configure_done (display, window); } } break; case PropertyNotify: GDK_NOTE (EVENTS, g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s", xevent->xproperty.window, xevent->xproperty.atom, "\"", gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), "\"")); if (window_private == NULL) { return_val = FALSE; break; } /* We compare with the serial of the last time we mapped the * window to avoid refetching properties that we set ourselves */ if (toplevel && xevent->xproperty.serial >= toplevel->map_serial) { if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE")) gdk_check_wm_state_changed (window); if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP")) gdk_check_wm_desktop_changed (window); } if (window_private->event_mask & GDK_PROPERTY_CHANGE_MASK) { event->property.type = GDK_PROPERTY_NOTIFY; event->property.window = window; event->property.atom = gdk_x11_xatom_to_atom_for_display (display, xevent->xproperty.atom); event->property.time = xevent->xproperty.time; event->property.state = xevent->xproperty.state; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -