⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdkevents-x11.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 5 页
字号:
  event->any.window = window;  event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;    if (window_private && GDK_WINDOW_DESTROYED (window))    {      if (xevent->type != DestroyNotify)	{	  return_val = FALSE;	  goto done;	}    }  else if (filter_window)    {      /* Apply per-window filters */      GdkWindowObject *filter_private = (GdkWindowObject *) filter_window;      GdkFilterReturn result;      if (filter_private->filters)	{	  g_object_ref (filter_window);	  	  result = gdk_event_apply_filters (xevent, event,					    filter_private->filters);	  	  g_object_unref (filter_window);      	  if (result != GDK_FILTER_CONTINUE)	    {	      return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;	      goto done;	    }	}    }        if (screen_x11 && screen_x11->wmspec_check_window != None &&      xwindow == screen_x11->wmspec_check_window)    {      if (xevent->type == DestroyNotify)        {          screen_x11->wmspec_check_window = None;          g_free (screen_x11->window_manager_name);          screen_x11->window_manager_name = g_strdup ("unknown");          /* careful, reentrancy */          _gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));        }            /* Eat events on this window unless someone had wrapped       * it as a foreign window       */      if (window == NULL)	{	  return_val = FALSE;	  goto done;	}    }  if (window &&      (xevent->xany.type == MotionNotify ||       xevent->xany.type == ButtonRelease))    {      if (_gdk_moveresize_handle_event (xevent))	{          return_val = FALSE;          goto done;        }    }    /* We do a "manual" conversion of the XEvent to a   *  GdkEvent. The structures are mostly the same so   *  the conversion is fairly straightforward. We also   *  optionally print debugging info regarding events   *  received.   */  return_val = TRUE;  if (window)    {      _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);    }  else    {      xoffset = 0;      yoffset = 0;    }  switch (xevent->type)    {    case KeyPress:      if (window_private == NULL)        {          return_val = FALSE;          break;        }      translate_key_event (display, event, xevent);      set_user_time (window, event);      break;    case KeyRelease:      if (window_private == NULL)        {          return_val = FALSE;          break;        }            /* Emulate detectable auto-repeat by checking to see       * if the next event is a key press with the same       * keycode and timestamp, and if so, ignoring the event.       */      if (!display_x11->have_xkb_autorepeat && XPending (xevent->xkey.display))	{	  XEvent next_event;	  XPeekEvent (xevent->xkey.display, &next_event);	  if (next_event.type == KeyPress &&	      next_event.xkey.keycode == xevent->xkey.keycode &&	      next_event.xkey.time == xevent->xkey.time)	    {	      return_val = FALSE;	      break;	    }	}      translate_key_event (display, event, xevent);      break;          case ButtonPress:      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 == NULL || 	  ((window_private->extension_events != 0) &&           display_x11->input_ignore_core))	{	  return_val = FALSE;	  break;	}            /* If we get a ButtonPress event where the button is 4 or 5,	 it's a Scroll event */      switch (xevent->xbutton.button)        {        case 4: /* up */        case 5: /* down */        case 6: /* left */        case 7: /* right */	  event->scroll.type = GDK_SCROLL;          if (xevent->xbutton.button == 4)            event->scroll.direction = GDK_SCROLL_UP;          else if (xevent->xbutton.button == 5)            event->scroll.direction = GDK_SCROLL_DOWN;          else if (xevent->xbutton.button == 6)            event->scroll.direction = GDK_SCROLL_LEFT;          else            event->scroll.direction = GDK_SCROLL_RIGHT;	  event->scroll.window = window;	  event->scroll.time = xevent->xbutton.time;	  event->scroll.x = xevent->xbutton.x + xoffset;	  event->scroll.y = xevent->xbutton.y + yoffset;	  event->scroll.x_root = (gfloat)xevent->xbutton.x_root;	  event->scroll.y_root = (gfloat)xevent->xbutton.y_root;	  event->scroll.state = (GdkModifierType) xevent->xbutton.state;	  event->scroll.device = display->core_pointer;	  set_screen_from_root (display, event, xevent->xbutton.root);	            break;                  default:	  event->button.type = GDK_BUTTON_PRESS;	  event->button.window = window;	  event->button.time = xevent->xbutton.time;	  event->button.x = xevent->xbutton.x + xoffset;	  event->button.y = xevent->xbutton.y + yoffset;	  event->button.x_root = (gfloat)xevent->xbutton.x_root;	  event->button.y_root = (gfloat)xevent->xbutton.y_root;	  event->button.axes = NULL;	  event->button.state = (GdkModifierType) xevent->xbutton.state;	  event->button.button = xevent->xbutton.button;	  event->button.device = display->core_pointer;	  	  set_screen_from_root (display, event, xevent->xbutton.root);	  _gdk_event_button_generate (display, event);          break;	}      set_user_time (window, event);      break;          case ButtonRelease:      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 == NULL ||	  ((window_private->extension_events != 0) &&           display_x11->input_ignore_core))	{	  return_val = FALSE;	  break;	}            /* We treat button presses as scroll wheel events, so ignore the release */      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5 ||          xevent->xbutton.button == 6 || xevent->xbutton.button ==7)	{	  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 + xoffset;      event->button.y = xevent->xbutton.y + yoffset;      event->button.x_root = (gfloat)xevent->xbutton.x_root;      event->button.y_root = (gfloat)xevent->xbutton.y_root;      event->button.axes = NULL;      event->button.state = (GdkModifierType) xevent->xbutton.state;      event->button.button = xevent->xbutton.button;      event->button.device = display->core_pointer;      set_screen_from_root (display, event, xevent->xbutton.root);            break;          case MotionNotify:      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 == NULL ||	  ((window_private->extension_events != 0) &&           display_x11->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 + xoffset;      event->motion.y = xevent->xmotion.y + yoffset;      event->motion.x_root = (gfloat)xevent->xmotion.x_root;      event->motion.y_root = (gfloat)xevent->xmotion.y_root;      event->motion.axes = NULL;      event->motion.state = (GdkModifierType) xevent->xmotion.state;      event->motion.is_hint = xevent->xmotion.is_hint;      event->motion.device = display->core_pointer;            set_screen_from_root (display, event, xevent->xmotion.root);            break;          case EnterNotify:      GDK_NOTE (EVENTS,		g_message ("enter notify:\t\twindow: %ld  detail: %d subwin: %ld",			   xevent->xcrossing.window,			   xevent->xcrossing.detail,			   xevent->xcrossing.subwindow));       if (window_private == NULL)        {          return_val = FALSE;          break;        }            /* Handle focusing (in the case where no window manager is running */      if (toplevel && xevent->xcrossing.detail != NotifyInferior)	{	  toplevel->has_pointer = TRUE;	  if (xevent->xcrossing.focus && !toplevel->has_focus_window)	    {	      gboolean had_focus = HAS_FOCUS (toplevel);	      	      toplevel->has_pointer_focus = TRUE;	      	      if (HAS_FOCUS (toplevel) != had_focus)		generate_focus_event (window, TRUE);	    }	}      /* Tell XInput stuff about it if appropriate */      if (window_private &&	  !GDK_WINDOW_DESTROYED (window) &&	  window_private->extension_events != 0)	_gdk_input_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_for_display (display, xevent->xcrossing.subwindow);      else	event->crossing.subwindow = NULL;            event->crossing.time = xevent->xcrossing.time;      event->crossing.x = xevent->xcrossing.x + xoffset;      event->crossing.y = xevent->xcrossing.y + yoffset;      event->crossing.x_root = xevent->xcrossing.x_root;      event->crossing.y_root = xevent->xcrossing.y_root;            set_screen_from_root (display, event, xevent->xcrossing.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:      GDK_NOTE (EVENTS, 		g_message ("leave notify:\t\twindow: %ld  detail: %d subwin: %ld",			   xevent->xcrossing.window,			   xevent->xcrossing.detail, xevent->xcrossing.subwindow));      if (window_private == NULL)        {          return_val = FALSE;          break;        }            /* Handle focusing (in the case where no window manager is running */      if (toplevel && xevent->xcrossing.detail != NotifyInferior)	{	  toplevel->has_pointer = FALSE;	  if (xevent->xcrossing.focus && !toplevel->has_focus_window)	    {	      gboolean had_focus = HAS_FOCUS (toplevel);	      	      toplevel->has_pointer_focus = FALSE;	      	      if (HAS_FOCUS (toplevel) != had_focus)		generate_focus_event (window, FALSE);	    }	}      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_for_display (display, xevent->xcrossing.subwindow);      else	event->crossing.subwindow = NULL;            event->crossing.time = xevent->xcrossing.time;      event->crossing.x = xevent->xcrossing.x + xoffset;      event->crossing.y = xevent->xcrossing.y + yoffset;      event->crossing.x_root = xevent->xcrossing.x_root;      event->crossing.y_root = xevent->xcrossing.y_root;            set_screen_from_root (display, event, xevent->xcrossing.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;            /* We only care about focus events that indicate that _this_       * window (not a ancestor or child) got or lost the focus       */    case FocusIn:      GDK_NOTE (EVENTS,		g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s",			   xevent->xfocus.window,			   notify_details[xevent->xfocus.detail],			   notify_modes[xevent->xfocus.mode]));            if (toplevel)	{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -