Esempio n. 1
0
void
_gdk_window_move_resize_child (GdkWindow *window,
			       gint       x,
			       gint       y,
			       gint       width,
			       gint       height)
{
  GdkWindowImplWin32 *impl;
  GdkWindowObject *obj;

  g_return_if_fail (window != NULL);
  g_return_if_fail (GDK_IS_WINDOW (window));

  obj = GDK_WINDOW_OBJECT (window);
  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);

  GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
			   _gdk_win32_drawable_description (window),
			   obj->x, obj->y, width, height, x, y));

  if (width > 65535 || height > 65535)
  {
    g_warning ("Native children wider or taller than 65535 pixels are not supported.");

    if (width > 65535)
      width = 65535;
    if (height > 65535)
      height = 65535;
  }

  obj->x = x;
  obj->y = y;
  obj->width = width;
  obj->height = height;

  _gdk_win32_window_tmp_unset_parent_bg (window);
  _gdk_win32_window_tmp_unset_bg (window, TRUE);
  
  GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
			   "NOACTIVATE|NOZORDER)\n",
			   GDK_WINDOW_HWND (window),
			   obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y, 
			   width, height));

  API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
			   obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y, 
			   width, height,
			   SWP_NOACTIVATE | SWP_NOZORDER));

  //_gdk_win32_window_tmp_reset_parent_bg (window);
  _gdk_win32_window_tmp_reset_bg (window, TRUE);
}
Esempio n. 2
0
static void
gdk_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(%p,NULL,%d,%d,0,0,"
			       "NOREDRAW|NOZORDER|NOACTIVATE|NOSIZE)\n",
			       _gdk_win32_drawable_description (window),
			       obj->x, obj->y,
			       GDK_WINDOW_HWND (window),
			       new_info.x, new_info.y));

      API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
			       new_info.x, new_info.y, 
			       0, 0,
			       SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
    }

  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;
    }
}
Esempio n. 3
0
void
_gdk_window_move_resize_child (GdkWindow *window,
			       gint       x,
			       gint       y,
			       gint       width,
			       gint       height)
{
  GdkWindowImplWin32 *impl;
  GdkWindowObject *obj;
  GdkWin32PositionInfo new_info;
  GdkWindowParentPos parent_pos;
  GList *tmp_list;
  gint d_xoffset, d_yoffset;
  gint dx, dy;
  gboolean is_move;
  gboolean is_resize;
  GdkRegion *new_clip_region;
  
  g_return_if_fail (window != NULL);
  g_return_if_fail (GDK_IS_WINDOW (window));

  obj = GDK_WINDOW_OBJECT (window);
  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
  
  GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
			   _gdk_win32_drawable_description (window),
			   obj->x, obj->y,
			   width, height, x, y));

  dx = x - obj->x;
  dy = y - obj->y;
  
  is_move = dx != 0 || dy != 0;
  is_resize = impl->width != width || impl->height != height;

  if (!is_move && !is_resize)
    {
      GDK_NOTE (MISC, g_print ("... neither move or resize\n"));
      return;
    }
  
  GDK_NOTE (MISC, g_print ("... %s%s\n",
			   is_move ? "is_move " : "",
			   is_resize ? "is_resize" : ""));

  obj->x = x;
  obj->y = y;
  impl->width = width;
  impl->height = height;

  gdk_window_compute_parent_pos (impl, &parent_pos);
  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);

  parent_pos.x += obj->x;
  parent_pos.y += obj->y;
  parent_pos.win32_x += new_info.x;
  parent_pos.win32_y += new_info.y;
  parent_pos.clip_rect = new_info.clip_rect;

  d_xoffset = new_info.x_offset - impl->position_info.x_offset;
  d_yoffset = new_info.y_offset - impl->position_info.y_offset;
  
  if (d_xoffset != 0 || d_yoffset != 0)
    {
      GDK_NOTE (MISC, g_print ("... d_offset=%+d%+d\n", d_xoffset, d_yoffset));

      if (!ScrollWindowEx (GDK_WINDOW_HWND (window),
			   -d_xoffset, -d_yoffset, /* in: scroll offsets */
			   NULL, /* in: scroll rect, NULL == entire client area */
			   NULL, /* in: restrict to */
			   NULL, /* in: update region */
			   NULL, /* out: update rect */
			   SW_SCROLLCHILDREN))
	WIN32_API_FAILED ("ScrollWindowEx");

      if (dx != d_xoffset || dy != d_yoffset || is_resize)
	{
	  GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
				   "NOACTIVATE|NOZORDER%s%s)\n",
				   GDK_WINDOW_HWND (window),
				   new_info.x, new_info.y, 
				   new_info.width, new_info.height,
				   (is_move ? "" : "|NOMOVE"),
				   (is_resize ? "" : "|NOSIZE")));

	  API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
				   new_info.x, new_info.y, 
				   new_info.width, new_info.height,
				   SWP_NOACTIVATE | SWP_NOZORDER | 
				   (is_move ? 0 : SWP_NOMOVE) |
				   (is_resize ? 0 : SWP_NOSIZE)));
	}

      if (impl->position_info.no_bg)
	gdk_window_tmp_reset_bg (window);

      if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
	{
	  GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_SHOWNA)\n",
				   GDK_WINDOW_HWND (window)));
	  ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
	}

      impl->position_info = new_info;
      
      tmp_list = obj->children;
      while (tmp_list)
	{
	  gdk_window_postmove (tmp_list->data, &parent_pos, FALSE);
	  tmp_list = tmp_list->next;
	}
    }
  else
    {
      if (impl->position_info.mapped && !new_info.mapped)
	{
	  GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_HIDE)\n",
				   GDK_WINDOW_HWND (window)));
	  ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
	}
      
      GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
			       "NOACTIVATE|NOZORDER%s%s)\n",
			       GDK_WINDOW_HWND (window),
			       new_info.x, new_info.y, 
			       new_info.width, new_info.height,
			       (is_move ? "" : "|NOMOVE"),
			       (is_resize ? "" : "|NOSIZE")));

      API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
			       new_info.x, new_info.y, 
			       new_info.width, new_info.height,
			       SWP_NOACTIVATE | SWP_NOZORDER | 
			       (is_move ? 0 : SWP_NOMOVE) |
			       (is_resize ? 0 : SWP_NOSIZE)));

      tmp_list = obj->children;
      while (tmp_list)
	{
	  gdk_window_postmove (tmp_list->data, &parent_pos, FALSE);
	  tmp_list = tmp_list->next;
	}

      if (impl->position_info.no_bg)
	gdk_window_tmp_reset_bg (window);

      if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
	{
	  GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_SHOWNA)\n",
				   GDK_WINDOW_HWND (window)));
	  ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
	}

      impl->position_info = new_info;
    }
  if (new_clip_region)
    gdk_window_post_scroll (window, new_clip_region);
}