GdkGrabStatus gdk_directfb_keyboard_grab (GdkDisplay *display, GdkWindow *window, gint owner_events, guint32 time) { GdkWindow *toplevel; GdkWindowImplDirectFB *impl; g_return_val_if_fail (GDK_IS_WINDOW (window), 0); if (_gdk_directfb_keyboard_grab_window) gdk_keyboard_ungrab (time); toplevel = gdk_directfb_window_find_toplevel (window); impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl); if (impl->window) { if (impl->window->GrabKeyboard (impl->window) == DFB_LOCKED) return GDK_GRAB_ALREADY_GRABBED; } _gdk_directfb_keyboard_grab_window = g_object_ref (window); _gdk_directfb_keyboard_grab_owner_events = owner_events; return GDK_GRAB_SUCCESS; }
static void gdk_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 GSList* test_find_widget_input_windows (GtkWidget *widget, gboolean input_only) { GList *node, *children; GSList *matches = NULL; gpointer udata; gdk_window_get_user_data (widget->window, &udata); if (udata == widget && (!input_only || (GDK_IS_WINDOW (widget->window) && GDK_WINDOW_OBJECT (widget->window)->input_only))) matches = g_slist_prepend (matches, widget->window); children = gdk_window_get_children (gtk_widget_get_parent_window (widget)); for (node = children; node; node = node->next) { gdk_window_get_user_data (node->data, &udata); if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && GDK_WINDOW_OBJECT (node->data)->input_only))) matches = g_slist_prepend (matches, node->data); } return g_slist_reverse (matches); }
GdkWindow * gdk_xynth_other_event_window (GdkWindow *window, GdkEventType type) { GdkWindow *w; guint32 evmask; ENTER(); w = window; while (w != _gdk_parent_root) { if ((w != window) && (GDK_WINDOW_OBJECT(w)->window_type != GDK_WINDOW_CHILD) && (g_object_get_data(G_OBJECT(w), "gdk-window-child-handler"))) { break; } evmask = GDK_WINDOW_OBJECT(w)->event_mask; if (evmask & type_masks[type]) { LEAVE(); return w; } w = gdk_window_get_parent(w); } LEAVE(); return NULL; }
/** * _gdk_xgrab_check_unmap: * @window: a #GdkWindow * @serial: serial from Unmap event (or from NextRequest(display) * if the unmap is being done by this client.) * * Checks to see if an unmap request or event causes the current * grab window to become not viewable, and if so, clear the * the pointer we keep to it. **/ void _gdk_xgrab_check_unmap (GdkWindow *window, gulong serial) { GdkDisplay *display = gdk_drawable_get_display (window); _gdk_display_end_pointer_grab (display, serial, window, TRUE); if (display->keyboard_grab.window && serial >= display->keyboard_grab.serial) { GdkWindowObject *private = GDK_WINDOW_OBJECT (window); GdkWindowObject *tmp = GDK_WINDOW_OBJECT (display->keyboard_grab.window); while (tmp && tmp != private) tmp = tmp->parent; if (tmp) _gdk_display_unset_has_keyboard_grab (display, TRUE); }
void _gdk_windowing_window_get_offsets (GdkWindow *window, gint *x_offset, gint *y_offset) { GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); *x_offset = impl->position_info.x_offset; *y_offset = impl->position_info.y_offset; }
GdkGrabStatus gdk_keyboard_grab (GdkWindow * window, gboolean owner_events, guint32 time) { gint return_val; unsigned long serial; GdkDisplay *display; GdkDisplayX11 *display_x11; GdkWindow *native; g_return_val_if_fail (window != NULL, 0); g_return_val_if_fail (GDK_IS_WINDOW (window), 0); native = gdk_window_get_toplevel (window); /* TODO: What do we do for offscreens and children? We need to proxy the grab somehow */ if (!GDK_IS_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (native)->impl)) return GDK_GRAB_SUCCESS; display = GDK_WINDOW_DISPLAY (native); display_x11 = GDK_DISPLAY_X11 (display); serial = NextRequest (GDK_WINDOW_XDISPLAY (native)); if (!GDK_WINDOW_DESTROYED (native)) { #ifdef G_ENABLE_DEBUG if (_gdk_debug_flags & GDK_DEBUG_NOGRABS) return_val = GrabSuccess; else #endif return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (native), GDK_WINDOW_XID (native), owner_events, GrabModeAsync, GrabModeAsync, time); if (G_UNLIKELY (!display_x11->trusted_client && return_val == AlreadyGrabbed)) /* we can't grab the keyboard, but we can do a GTK-local grab */ return_val = GrabSuccess; } else return_val = AlreadyGrabbed; if (return_val == GrabSuccess) _gdk_display_set_has_keyboard_grab (display, window, native, owner_events, serial, time); return gdk_x11_convert_grab_status (return_val); }
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); }
void _gdk_window_init_position (GdkWindow *window) { GdkWindowParentPos parent_pos; GdkWindowImplWin32 *impl; g_return_if_fail (GDK_IS_WINDOW (window)); impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); gdk_window_compute_parent_pos (impl, &parent_pos); gdk_window_compute_position (impl, &parent_pos, &impl->position_info); }
GdkGrabStatus gdk_directfb_pointer_grab (GdkWindow *window, gint owner_events, GdkEventMask event_mask, GdkWindow *confine_to, GdkCursor *cursor, guint32 time, gboolean implicit_grab) { GdkWindow *toplevel; GdkWindowImplDirectFB *impl; if (_gdk_directfb_pointer_grab_window) { if (implicit_grab && !_gdk_directfb_pointer_implicit_grab) return GDK_GRAB_ALREADY_GRABBED; gdk_pointer_ungrab (time); } toplevel = gdk_directfb_window_find_toplevel (window); impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl); if (impl->window) { if (impl->window->GrabPointer (impl->window) == DFB_LOCKED) return GDK_GRAB_ALREADY_GRABBED; } if (event_mask & GDK_BUTTON_MOTION_MASK) event_mask |= (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK); _gdk_directfb_pointer_implicit_grab = implicit_grab; _gdk_directfb_pointer_grab_window = g_object_ref (window); _gdk_directfb_pointer_grab_owner_events = owner_events; _gdk_directfb_pointer_grab_confine = (confine_to ? g_object_ref (confine_to) : NULL); _gdk_directfb_pointer_grab_events = event_mask; _gdk_directfb_pointer_grab_cursor = (cursor ? gdk_cursor_ref (cursor) : NULL); gdk_directfb_window_send_crossing_events (NULL, window, GDK_CROSSING_GRAB); return GDK_GRAB_SUCCESS; }
void gdk_directfb_pointer_ungrab (guint32 time, gboolean implicit_grab) { GdkWindow *toplevel; GdkWindow *mousewin; GdkWindow *old_grab_window; GdkWindowImplDirectFB *impl; if (implicit_grab && !_gdk_directfb_pointer_implicit_grab) return; if (!_gdk_directfb_pointer_grab_window) return; toplevel = gdk_directfb_window_find_toplevel (_gdk_directfb_pointer_grab_window); impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl); if (impl->window) impl->window->UngrabPointer (impl->window); if (_gdk_directfb_pointer_grab_confine) { g_object_unref (_gdk_directfb_pointer_grab_confine); _gdk_directfb_pointer_grab_confine = NULL; } if (_gdk_directfb_pointer_grab_cursor) { gdk_cursor_unref (_gdk_directfb_pointer_grab_cursor); _gdk_directfb_pointer_grab_cursor = NULL; } old_grab_window = _gdk_directfb_pointer_grab_window; _gdk_directfb_pointer_grab_window = NULL; _gdk_directfb_pointer_implicit_grab = FALSE; mousewin = gdk_window_at_pointer (NULL, NULL); gdk_directfb_window_send_crossing_events (old_grab_window, mousewin, GDK_CROSSING_UNGRAB); g_object_unref (old_grab_window); }
void gdk_directfb_keyboard_ungrab (GdkDisplay *display, guint32 time) { GdkWindow *toplevel; GdkWindowImplDirectFB *impl; if (!_gdk_directfb_keyboard_grab_window) return; toplevel = gdk_directfb_window_find_toplevel (_gdk_directfb_keyboard_grab_window); impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl); if (impl->window) impl->window->UngrabKeyboard (impl->window); g_object_unref (_gdk_directfb_keyboard_grab_window); _gdk_directfb_keyboard_grab_window = NULL; }
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); }
GdkWindow * gdk_xynth_pointer_event_window (GdkWindow *window, GdkEventType type) { guint evmask; GdkWindow *w; GdkModifierType mask; ENTER(); gdk_xynth_mouse_get_info(NULL, NULL, &mask); if (_gdk_xynth_pointer_grab_window && !_gdk_xynth_pointer_grab_owner_events) { evmask = _gdk_xynth_pointer_grab_events; if (evmask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK)) { if (((mask & GDK_BUTTON1_MASK) && (evmask & GDK_BUTTON1_MOTION_MASK)) || ((mask & GDK_BUTTON2_MASK) && (evmask & GDK_BUTTON2_MOTION_MASK)) || ((mask & GDK_BUTTON3_MASK) && (evmask & GDK_BUTTON3_MOTION_MASK))) { evmask |= GDK_POINTER_MOTION_MASK; } } if (evmask & type_masks[type]) { if (_gdk_xynth_pointer_grab_owner_events) { LEAVE(); return _gdk_xynth_pointer_grab_window; } else { GdkWindowObject *obj= GDK_WINDOW_OBJECT(window); while (obj != NULL && obj != GDK_WINDOW_OBJECT(_gdk_xynth_pointer_grab_window)) { obj = (GdkWindowObject *) obj->parent; } if (obj == GDK_WINDOW_OBJECT(_gdk_xynth_pointer_grab_window)) { LEAVE(); return window; } else { LEAVE(); return _gdk_xynth_pointer_grab_window; } } } } w = window; while (w != _gdk_parent_root) { /* Huge hack, so that we don't propagate events to GtkWindow->frame */ if ((w != window) && (GDK_WINDOW_OBJECT(w)->window_type != GDK_WINDOW_CHILD) && (g_object_get_data(G_OBJECT(w), "gdk-window-child-handler"))) { break; } evmask = GDK_WINDOW_OBJECT(w)->event_mask; if (evmask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK)) { if (((mask & GDK_BUTTON1_MASK) && (evmask & GDK_BUTTON1_MOTION_MASK)) || ((mask & GDK_BUTTON2_MASK) && (evmask & GDK_BUTTON2_MOTION_MASK)) || ((mask & GDK_BUTTON3_MASK) && (evmask & GDK_BUTTON3_MOTION_MASK))) { evmask |= GDK_POINTER_MOTION_MASK; } } if (evmask & type_masks[type]) { LEAVE(); return w; } w = gdk_window_get_parent(w); } LEAVE(); return NULL; }
void my_gdk_draw_text(GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length) { #ifdef MOZ_WIDGET_GTK GdkWindowPrivate *drawable_private; GdkFontPrivate *font_private; GdkGCPrivate *gc_private; #endif /* MOZ_WIDGET_GTK */ g_return_if_fail (drawable != NULL); g_return_if_fail (font != NULL); g_return_if_fail (gc != NULL); g_return_if_fail (text != NULL); #ifdef MOZ_WIDGET_GTK drawable_private = (GdkWindowPrivate*) drawable; if (drawable_private->destroyed) return; gc_private = (GdkGCPrivate*) gc; font_private = (GdkFontPrivate*) font; #endif /* MOZ_WIDGET_GTK */ #ifdef MOZ_WIDGET_GTK2 if (GDK_IS_WINDOW(drawable) && GDK_WINDOW_OBJECT(drawable)->destroyed) return; #endif /* MOZ_WIDGET_GTK2 */ if (font->type == GDK_FONT_FONT) { #ifdef MOZ_WIDGET_GTK XFontStruct *xfont = (XFontStruct *) font_private->xfont; #endif /* MOZ_WIDGET_GTK */ #ifdef MOZ_WIDGET_GTK2 XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT(font); #endif /* MOZ_WIDGET_GTK2 */ // gdk does this... we don't need it.. // XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid); // We clamp the sizes down to 32768 which is the maximum width of // a window. Even if a font was 1 pixel high and started at the // left, the maximum size of a draw request could only be 32k. if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)) { #ifdef MOZ_WIDGET_GTK XDrawString (drawable_private->xdisplay, drawable_private->xwindow, gc_private->xgc, x, y, text, MIN(text_length, 32768)); #endif /* MOZ_WIDGET_GTK */ #ifdef MOZ_WIDGET_GTK2 XDrawString (GDK_WINDOW_XDISPLAY(drawable), GDK_DRAWABLE_XID(drawable), GDK_GC_XGC(gc), x, y, text, MIN(text_length, 32768)); #endif /* MOZ_WIDGET_GTK2 */ } else { #ifdef MOZ_WIDGET_GTK XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow, gc_private->xgc, x, y, (XChar2b *) text, MIN((text_length / 2), 32768)); #endif /* MOZ_WIDGET_GTK */ #ifdef MOZ_WIDGET_GTK2 XDrawString16 (GDK_WINDOW_XDISPLAY(drawable), GDK_DRAWABLE_XID(drawable), GDK_GC_XGC(gc), x, y, (XChar2b *) text, MIN((text_length / 2), 32768)); #endif /* MOZ_WIDGET_GTK2 */ } } else if (font->type == GDK_FONT_FONTSET) { #ifdef MOZ_WIDGET_GTK XFontSet fontset = (XFontSet) font_private->xfont; XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow, fontset, gc_private->xgc, x, y, text, text_length); #endif /* MOZ_WIDGET_GTK */ #ifdef MOZ_WIDGET_GTK2 XFontSet fontset = (XFontSet) GDK_FONT_XFONT(font); XmbDrawString (GDK_WINDOW_XDISPLAY(drawable), GDK_DRAWABLE_XID(drawable), fontset, GDK_GC_XGC(gc), x, y, text, text_length); #endif /* MOZ_WIDGET_GTK2 */ } else g_error("undefined font type\n"); }
gint gdk_screen_get_height (GdkScreen *screen) { return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->height; }
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); }
GdkPixmap* gdk_pixmap_new (GdkDrawable *drawable, gint width, gint height, gint depth) { GIXSurfacePixelFormat format; GdkPixmap *pixmap; GdkDrawableImplGix *draw_impl; g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (drawable != NULL || depth != -1, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL); if (!drawable) drawable = _gdk_parent_root; if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable)) return NULL; GDK_NOTE (MISC, g_print ("gdk_pixmap_new: %dx%dx%d\n", width, height, depth)); if (depth == -1) { draw_impl = GDK_DRAWABLE_IMPL_GIX (GDK_WINDOW_OBJECT (drawable)->impl); g_return_val_if_fail (draw_impl != NULL, NULL); format = gi_screen_format(); depth = GI_RENDER_FORMAT_BPP (format); } else { switch (depth) { case 1: format = GI_RENDER_a8; break; case 8: format = GI_RENDER_r3g3b2; break; case 15: format = GI_RENDER_x1r5g5b5; break; case 16: format = GI_RENDER_r5g6b5; break; case 24: format = GI_RENDER_r8g8b8; break; case 32: format = GI_RENDER_x8r8g8b8; break; default: g_message ("unimplemented %s for depth %d", __FUNCTION__, depth); return NULL; } } pixmap = g_object_new (gdk_pixmap_get_type (), NULL); draw_impl = GDK_DRAWABLE_IMPL_GIX (GDK_PIXMAP_OBJECT (pixmap)->impl); draw_impl->window_id = gi_create_pixmap_window( GDK_DRAWABLE_IMPL_GIX (drawable)->window_id,width,height,format); //surface->Clear (surface, 0x0, 0x0, 0x0, 0x0); //surface->GetSize (surface, &draw_impl->width, &draw_impl->height); //surface->GetPixelFormat (surface, &draw_impl->format); draw_impl->width = width; draw_impl->height = height; draw_impl->format = format; draw_impl->abs_x = draw_impl->abs_y = 0; GDK_PIXMAP_OBJECT (pixmap)->depth = depth; return pixmap; }
void gdk_window_scroll (GdkWindow *window, gint dx, gint dy) { GdkRegion *invalidate_region; GdkWindowImplWin32 *impl; GdkWindowObject *obj; GList *tmp_list; GdkWindowParentPos parent_pos; HRGN native_invalidate_region; g_return_if_fail (GDK_IS_WINDOW (window)); if (GDK_WINDOW_DESTROYED (window)) return; GDK_NOTE (EVENTS, g_print ("gdk_window_scroll: %p %d,%d\n", GDK_WINDOW_HWND (window), dx, dy)); obj = GDK_WINDOW_OBJECT (window); impl = GDK_WINDOW_IMPL_WIN32 (obj->impl); if (dx == 0 && dy == 0) return; /* Move the current invalid region */ if (obj->update_area) gdk_region_offset (obj->update_area, dx, dy); gdk_window_compute_parent_pos (impl, &parent_pos); parent_pos.x += obj->x; parent_pos.y += obj->y; parent_pos.win32_x += impl->position_info.x; parent_pos.win32_y += impl->position_info.y; parent_pos.clip_rect = impl->position_info.clip_rect; gdk_window_tmp_unset_bg (window); native_invalidate_region = CreateRectRgn (0, 0, 0, 0); if (native_invalidate_region == NULL) WIN32_API_FAILED ("CreateRectRgn"); API_CALL (ScrollWindowEx, (GDK_WINDOW_HWND (window), dx, dy, NULL, NULL, native_invalidate_region, NULL, SW_SCROLLCHILDREN)); if (impl->position_info.no_bg) gdk_window_tmp_reset_bg (window); tmp_list = obj->children; while (tmp_list) { GDK_WINDOW_OBJECT(tmp_list->data)->x += dx; GDK_WINDOW_OBJECT(tmp_list->data)->y += dy; gdk_window_postmove (tmp_list->data, &parent_pos, FALSE); tmp_list = tmp_list->next; } if (native_invalidate_region != NULL) { invalidate_region = _gdk_win32_hrgn_to_region (native_invalidate_region); gdk_region_offset (invalidate_region, impl->position_info.x_offset, impl->position_info.y_offset); gdk_window_invalidate_region (window, invalidate_region, TRUE); gdk_region_destroy (invalidate_region); GDI_CALL (DeleteObject, (native_invalidate_region)); } }
static void gdk_window_compute_position (GdkWindowImplWin32 *window, GdkWindowParentPos *parent_pos, GdkWin32PositionInfo *info) { GdkWindowObject *wrapper; 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; } }
gint gdk_screen_get_width (GdkScreen *screen) { return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->width; }
void gdk_window_move_region (GdkWindow *window, GdkRegion *region, gint dx, gint dy) { GdkRegion *invalidate_region; GdkWindowImplWin32 *impl; GdkWindowObject *obj; GdkRectangle src_rect, dest_rect; HRGN hrgn; RECT clipRect, destRect; g_return_if_fail (GDK_IS_WINDOW (window)); if (GDK_WINDOW_DESTROYED (window)) return; obj = GDK_WINDOW_OBJECT (window); impl = GDK_WINDOW_IMPL_WIN32 (obj->impl); if (dx == 0 && dy == 0) return; /* Move the current invalid region */ if (obj->update_area) gdk_region_offset (obj->update_area, dx, dy); /* impl->position_info.clip_rect isn't meaningful for toplevels */ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD) src_rect = impl->position_info.clip_rect; else { src_rect.x = 0; src_rect.y = 0; src_rect.width = impl->width; src_rect.height = impl->height; } invalidate_region = gdk_region_rectangle (&src_rect); dest_rect = src_rect; dest_rect.x += dx; dest_rect.y += dy; gdk_rectangle_intersect (&dest_rect, &src_rect, &dest_rect); if (dest_rect.width > 0 && dest_rect.height > 0) { GdkRegion *tmp_region; tmp_region = gdk_region_rectangle (&dest_rect); gdk_region_subtract (invalidate_region, tmp_region); gdk_region_destroy (tmp_region); } /* no guffaw scroll on win32 */ hrgn = _gdk_win32_gdkregion_to_hrgn(invalidate_region, 0, 0); gdk_region_destroy (invalidate_region); destRect.left = dest_rect.y; destRect.top = dest_rect.x; destRect.right = dest_rect.x + dest_rect.width; destRect.bottom = dest_rect.y + dest_rect.height; clipRect.left = src_rect.y; clipRect.top = src_rect.x; clipRect.right = src_rect.x + src_rect.width; clipRect.bottom = src_rect.y + src_rect.height; g_print ("ScrollWindowEx(%d, %d, ...) - if you see this work, remove trace;)\n", dx, dy); API_CALL(ScrollWindowEx, (GDK_WINDOW_HWND (window), dx, dy, /* in: scroll offsets */ NULL, /* in: scroll rect, NULL == entire client area */ &clipRect, /* in: restrict to */ hrgn, /* in: update region */ NULL, /* out: update rect */ SW_INVALIDATE)); API_CALL(DeleteObject, (hrgn)); }