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

📄 gdkgeometry-win32.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 2 页
字号:
  int parent_x_offset;  int parent_y_offset;  g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));  wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);    info->big = FALSE;    if (window->width <= SIZE_LIMIT)    {      info->width = window->width;      info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;    }  else    {      info->big = TRUE;      info->width = SIZE_LIMIT;      if (parent_pos->x + wrapper->x < -(SIZE_LIMIT/2))	{	  if (parent_pos->x + wrapper->x + window->width < (SIZE_LIMIT/2))	    info->x = parent_pos->x + wrapper->x + window->width - info->width - parent_pos->win32_x;	  else	    info->x = -(SIZE_LIMIT/2) - parent_pos->win32_x;	}      else	info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;    }  if (window->height <= SIZE_LIMIT)    {      info->height = window->height;      info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;    }  else    {      info->big = TRUE;      info->height = SIZE_LIMIT;      if (parent_pos->y + wrapper->y < -(SIZE_LIMIT/2))	{	  if (parent_pos->y + wrapper->y + window->height < (SIZE_LIMIT/2))	    info->y = parent_pos->y + wrapper->y + window->height - info->height - parent_pos->win32_y;	  else	    info->y = -(SIZE_LIMIT/2) - parent_pos->win32_y;	}      else	info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;    }  parent_x_offset = parent_pos->win32_x - parent_pos->x;  parent_y_offset = parent_pos->win32_y - parent_pos->y;    info->x_offset = parent_x_offset + info->x - wrapper->x;  info->y_offset = parent_y_offset + info->y - wrapper->y;  /* We don't considering the clipping of toplevel windows and their immediate children   * by their parents, and simply always map those windows.   */  if (parent_pos->clip_rect.width == G_MAXINT)    info->mapped = TRUE;  /* Check if the window would wrap around into the visible space in either direction */  else if (info->x + parent_x_offset < parent_pos->clip_rect.x + parent_pos->clip_rect.width - 65536 ||      info->x + info->width + parent_x_offset > parent_pos->clip_rect.x + 65536 ||      info->y + parent_y_offset < parent_pos->clip_rect.y + parent_pos->clip_rect.height - 65536 ||      info->y + info->height + parent_y_offset  > parent_pos->clip_rect.y + 65536)    info->mapped = FALSE;  else    info->mapped = TRUE;  info->no_bg = FALSE;  if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)    {      info->clip_rect.x = wrapper->x;      info->clip_rect.y = wrapper->y;      info->clip_rect.width = window->width;      info->clip_rect.height = window->height;            gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);      info->clip_rect.x -= wrapper->x;      info->clip_rect.y -= wrapper->y;    }  else    {      info->clip_rect.x = 0;      info->clip_rect.y = 0;      info->clip_rect.width = G_MAXINT;      info->clip_rect.height = G_MAXINT;    }}static voidgdk_window_compute_parent_pos (GdkWindowImplWin32 *window,			       GdkWindowParentPos *parent_pos){  GdkWindowObject *wrapper;  GdkWindowObject *parent;  GdkRectangle tmp_clip;    int clip_xoffset = 0;  int clip_yoffset = 0;  g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));  wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);    parent_pos->x = 0;  parent_pos->y = 0;  parent_pos->win32_x = 0;  parent_pos->win32_y = 0;  /* We take a simple approach here and simply consider toplevel   * windows not to clip their children on the right/bottom, since the   * size of toplevel windows is not directly under our   * control. Clipping only really matters when scrolling and   * generally we aren't going to be moving the immediate child of a   * toplevel beyond the bounds of that toplevel.   *   * We could go ahead and recompute the clips of toplevel windows and   * their descendents when we receive size notification, but it would   * probably not be an improvement in most cases.   */  parent_pos->clip_rect.x = 0;  parent_pos->clip_rect.y = 0;  parent_pos->clip_rect.width = G_MAXINT;  parent_pos->clip_rect.height = G_MAXINT;  parent = (GdkWindowObject *)wrapper->parent;  while (parent && parent->window_type == GDK_WINDOW_CHILD)    {      GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);            tmp_clip.x = - clip_xoffset;      tmp_clip.y = - clip_yoffset;      tmp_clip.width = impl->width;      tmp_clip.height = impl->height;      gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);      parent_pos->x += parent->x;      parent_pos->y += parent->y;      parent_pos->win32_x += impl->position_info.x;      parent_pos->win32_y += impl->position_info.y;      clip_xoffset += parent->x;      clip_yoffset += parent->y;      parent = (GdkWindowObject *)parent->parent;    }}static voidgdk_window_postmove (GdkWindow          *window,		     GdkWindowParentPos *parent_pos,		     gboolean	         anti_scroll){  GdkWindowImplWin32 *impl;  GdkWindowObject *obj;  GdkWin32PositionInfo new_info;  GList *tmp_list;  gint d_xoffset, d_yoffset;  GdkWindowParentPos this_pos;  GdkRegion *new_clip_region;  obj = (GdkWindowObject *) window;  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);    gdk_window_compute_position (impl, parent_pos, &new_info);  new_clip_region =    gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);  this_pos.x = parent_pos->x + obj->x;  this_pos.y = parent_pos->y + obj->y;  this_pos.win32_x = parent_pos->win32_x + new_info.x;  this_pos.win32_y = parent_pos->win32_y + new_info.y;  this_pos.clip_rect = new_info.clip_rect;  if (impl->position_info.mapped && !new_info.mapped)    ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);  d_xoffset = new_info.x_offset - impl->position_info.x_offset;  d_yoffset = new_info.y_offset - impl->position_info.y_offset;    if (anti_scroll || (anti_scroll = d_xoffset != 0 || d_yoffset != 0))    {      GDK_NOTE (MISC, g_print ("gdk_window_postmove: %s@+%d+%d\n"			       "...SetWindowPos(%dx%d@+%d+%d)\n",			       _gdk_win32_drawable_description (window),			       obj->x, obj->y,			       new_info.width, new_info.height,			       new_info.x, new_info.y));      if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,                         new_info.x, new_info.y,                          0, 0,                         SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE))        WIN32_API_FAILED ("SetWindowPos");    }  if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))    ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);  if (impl->position_info.no_bg)    gdk_window_tmp_reset_bg (window);  impl->position_info = new_info;  if (new_clip_region)    gdk_window_post_scroll (window, new_clip_region);  tmp_list = obj->children;  while (tmp_list)    {      gdk_window_postmove (tmp_list->data, &this_pos, anti_scroll);      tmp_list = tmp_list->next;    }}gboolean_gdk_windowing_window_queue_antiexpose (GdkWindow *window,					GdkRegion *area){  HRGN hrgn = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);  GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose: ValidateRgn %p %s\n",			     GDK_WINDOW_HWND (window),			     _gdk_win32_gdkregion_to_string (area)));  ValidateRgn (GDK_WINDOW_HWND (window), hrgn);  DeleteObject (hrgn);  return FALSE;}void_gdk_window_process_expose (GdkWindow *window,			    GdkRegion *invalidate_region){  GdkWindowImplWin32 *impl;  GdkRegion *clip_region;  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);    GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose: %p %s\n",			     GDK_WINDOW_HWND (window),			     _gdk_win32_gdkregion_to_string (invalidate_region)));  clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);  gdk_region_intersect (invalidate_region, clip_region);  if (!gdk_region_empty (invalidate_region))    gdk_window_invalidate_region (window, invalidate_region, FALSE);    gdk_region_destroy (clip_region);}static voidgdk_window_tmp_unset_bg (GdkWindow *window){  GdkWindowImplWin32 *impl;  GdkWindowObject *obj;  obj = (GdkWindowObject *) window;  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);  impl->position_info.no_bg = TRUE;  /*   * The X version sets background = None to avoid updateing for a moment.   * Not sure if this could really emulate it.   */  if (obj->bg_pixmap != GDK_NO_BG)    /* handled in WM_ERASEBKGRND proceesing */;}static voidgdk_window_tmp_reset_bg (GdkWindow *window){  GdkWindowImplWin32 *impl;  GdkWindowObject *obj;  obj = (GdkWindowObject *) window;  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);  impl->position_info.no_bg = FALSE;}static GdkRegion *gdk_window_clip_changed (GdkWindow    *window,			 GdkRectangle *old_clip,			 GdkRectangle *new_clip){  GdkWindowImplWin32 *impl;  GdkWindowObject *obj;  GdkRegion *old_clip_region;  GdkRegion *new_clip_region;    if (((GdkWindowObject *)window)->input_only)    return NULL;  obj = (GdkWindowObject *) window;  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);    old_clip_region = gdk_region_rectangle (old_clip);  new_clip_region = gdk_region_rectangle (new_clip);  /* Trim invalid region of window to new clip rectangle   */  if (obj->update_area)    gdk_region_intersect (obj->update_area, new_clip_region);  /* Invalidate newly exposed portion of window   */  gdk_region_subtract (new_clip_region, old_clip_region);  if (!gdk_region_empty (new_clip_region))    gdk_window_tmp_unset_bg (window);  else    {      gdk_region_destroy (new_clip_region);      new_clip_region = NULL;    }  gdk_region_destroy (old_clip_region);  return new_clip_region;}static voidgdk_window_post_scroll (GdkWindow    *window,			GdkRegion    *new_clip_region){  GDK_NOTE (EVENTS,	    g_print ("gdk_window_clip_changed: invalidating region: %s\n",		     _gdk_win32_gdkregion_to_string (new_clip_region)));  gdk_window_invalidate_region (window, new_clip_region, FALSE);  gdk_region_destroy (new_clip_region);}

⌨️ 快捷键说明

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