static void ViewOvBoxSizeAllocate(GtkWidget *widget, // IN GtkAllocation *allocation) // IN { ViewOvBox *that; ViewOvBoxPrivate *priv; GtkAllocation under; GtkAllocation over; gtk_widget_set_allocation (widget, allocation); that = VIEW_OV_BOX(widget); priv = that->priv; ViewOvBoxGetUnderGeometry(that, &under.x, &under.y, &under.width, &under.height); ViewOvBoxGetOverGeometry(that, &over.x, &over.y, &over.width, &over.height); if (gtk_widget_get_realized(widget)) { gdk_window_move_resize(gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_move_resize(priv->underWin, under.x, under.y, under.width, under.height); gdk_window_move_resize(priv->overWin, over.x, over.y, over.width, over.height); } under.x = 0; under.y = 0; gtk_widget_size_allocate(priv->under, &under); over.x = 0; over.y = 0; gtk_widget_size_allocate(priv->over, &over); }
/* Pøidìlení velikosti widgetu */ static void gtk_ev_size_allocate(GtkWidget *widget, GtkAllocation *alloc) { static const gint spacing = 10; GtkEv *ev; g_return_if_fail(GTK_IS_EV(widget)); g_return_if_fail(alloc); ev = GTK_EV(widget); widget->allocation = *alloc; ev->ev_win_rect.width = MAX(alloc->width-2*spacing, 0); ev->ev_win_rect.height = MAX(alloc->height/5-2*spacing, 0); ev->ev_win_rect.x = (alloc->width - ev->ev_win_rect.width)/2; ev->ev_win_rect.y = MIN(spacing, alloc->height); ev->list_rect.x = ev->ev_win_rect.x; ev->list_rect.y = ev->ev_win_rect.y + ev->ev_win_rect.height + spacing; ev->list_rect.width = ev->ev_win_rect.width; ev->list_rect.height = MAX(alloc->height - ev->ev_win_rect.height - 3*spacing, 0); if(GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize(widget->window, alloc->x, alloc->y, alloc->width, alloc->height); gdk_window_move_resize(ev->ev_win, ev->ev_win_rect.x, ev->ev_win_rect.y, ev->ev_win_rect.width, ev->ev_win_rect.height); } }
// IM-2016-01-21: [[ NativeLayer ]] Place the socket window relative to its // container, so only the visible area (clipped by any containing groups) // is displayed. void MCNativeLayerX11::doSetGeometry(const MCRectangle& p_rect) { m_rect = p_rect; updateContainerGeometry(); MCRectangle t_rect; t_rect = m_rect; t_rect.x -= m_intersect_rect.x; t_rect.y -= m_intersect_rect.y; // Move the overlay window first, to ensure events don't get stolen // Clear any minimum size parameters for the GTK widgets gtk_widget_set_size_request(GTK_WIDGET(m_socket), -1, -1); // Resize the socket gdk_window_move_resize(gtk_widget_get_window(GTK_WIDGET(m_socket)), t_rect.x, t_rect.y, t_rect.width, t_rect.height); // We need to set the requested minimum size in order to get in-process GTK // widgets to re-size automatically. Unfortunately, that is the only widget // category that this works for... others need to do it themselves. gtk_widget_set_size_request(GTK_WIDGET(m_socket), t_rect.width, t_rect.height); // Update the contained window too GdkWindow* t_remote; t_remote = gtk_socket_get_plug_window(m_socket); if (t_remote != NULL) gdk_window_move_resize(t_remote, t_rect.x, t_rect.y, t_rect.width, t_rect.height); }
static void gd_stack_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GdStack *stack = GD_STACK (widget); GdStackPrivate *priv = stack->priv; GtkAllocation child_allocation; g_return_if_fail (allocation != NULL); gtk_widget_set_allocation (widget, allocation); child_allocation = *allocation; child_allocation.x = 0; child_allocation.y = 0; if (priv->last_visible_child) gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation); if (priv->visible_child) gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation); if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (priv->view_window, allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_move_resize (priv->bin_window, get_bin_window_x (stack, allocation), 0, allocation->width, allocation->height); } }
static void gtk_rotated_bin_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkRotatedBin *bin = GTK_ROTATED_BIN (widget); guint border_width; gint w, h; gdouble s, c; gtk_widget_set_allocation (widget, allocation); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); w = allocation->width - border_width * 2; h = allocation->height - border_width * 2; if (gtk_widget_get_realized (widget)) gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x + border_width, allocation->y + border_width, w, h); if (bin->child && gtk_widget_get_visible (bin->child)) { GtkRequisition child_requisition; GtkAllocation child_allocation; s = sin (bin->angle); c = cos (bin->angle); gtk_widget_get_preferred_size (bin->child, &child_requisition, NULL); child_allocation.x = 0; child_allocation.y = 0; child_allocation.height = child_requisition.height; if (c == 0.0) child_allocation.width = h / s; else if (s == 0.0) child_allocation.width = w / c; else child_allocation.width = MIN ((w - s * child_allocation.height) / c, (h - c * child_allocation.height) / s); if (gtk_widget_get_realized (widget)) gdk_window_move_resize (bin->offscreen_window, child_allocation.x, child_allocation.y, child_allocation.width, child_allocation.height); child_allocation.x = child_allocation.y = 0; gtk_widget_size_allocate (bin->child, &child_allocation); } }
static void gtk_notification_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkNotification *notification = GTK_NOTIFICATION (widget); GtkNotificationPrivate *priv = notification->priv; GtkBin *bin = GTK_BIN (widget); GtkAllocation child_allocation; GtkBorder padding; GtkWidget *child; int button_width; gtk_widget_set_allocation (widget, allocation); /* If somehow the notification changes while not hidden and we're not animating, immediately follow the resize */ if (priv->animate_y > 0 && !priv->animate_timeout) priv->animate_y = allocation->height; get_padding_and_border (notification, &padding); if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_move_resize (priv->bin_window, 0, -allocation->height + priv->animate_y, allocation->width, allocation->height); } child_allocation.x = SHADOW_OFFSET_X + padding.left; child_allocation.y = padding.top; child_allocation.height = MAX (1, allocation->height - SHADOW_OFFSET_Y - padding.top - padding.bottom); gtk_widget_get_preferred_width_for_height (priv->close_button, child_allocation.height, NULL, &button_width); child_allocation.width = MAX (1, allocation->width - 2 * SHADOW_OFFSET_X - padding.left - padding.right - button_width); child = gtk_bin_get_child (bin); if (child && gtk_widget_get_visible (child)) gtk_widget_size_allocate (child, &child_allocation); child_allocation.x += child_allocation.width; child_allocation.width = button_width; gtk_widget_size_allocate (priv->close_button, &child_allocation); }
static void cvImageWidget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { CvImageWidget *image_widget; //printf("cvImageWidget_size_allocate\n"); g_return_if_fail (widget != NULL); g_return_if_fail (CV_IS_IMAGE_WIDGET (widget)); g_return_if_fail (allocation != NULL); widget->allocation = *allocation; image_widget = CV_IMAGE_WIDGET (widget); if( (image_widget->flags & CV_WINDOW_AUTOSIZE)==0 && image_widget->original_image ){ // (re) allocated scaled image if( image_widget->flags & CV_WINDOW_NO_IMAGE ){ cvImageWidget_set_size( widget, image_widget->original_image->cols, image_widget->original_image->rows); } else{ cvImageWidget_set_size( widget, allocation->width, allocation->height ); } cvResize( image_widget->original_image, image_widget->scaled_image, CV_INTER_AREA ); } if (GTK_WIDGET_REALIZED (widget)) { image_widget = CV_IMAGE_WIDGET (widget); if( image_widget->original_image && ((image_widget->flags & CV_WINDOW_AUTOSIZE) || (image_widget->flags & CV_WINDOW_NO_IMAGE)) ) { widget->allocation.width = image_widget->original_image->cols; widget->allocation.height = image_widget->original_image->rows; gdk_window_move_resize( widget->window, allocation->x, allocation->y, image_widget->original_image->cols, image_widget->original_image->rows ); if(image_widget->flags & CV_WINDOW_NO_IMAGE){ image_widget->flags &= ~CV_WINDOW_NO_IMAGE; gtk_widget_queue_resize( GTK_WIDGET(widget) ); } } else{ gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height ); } } }
static void gtk_revealer_real_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkRevealer *revealer = GTK_REVEALER (widget); GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GtkAllocation child_allocation; GtkWidget *child; gboolean window_visible; int bin_x, bin_y; GtkRevealerTransitionType transition; g_return_if_fail (allocation != NULL); gtk_widget_set_allocation (widget, allocation); gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation); child = gtk_bin_get_child (GTK_BIN (revealer)); if (child != NULL && gtk_widget_get_visible (child)) gtk_widget_size_allocate (child, &child_allocation); if (gtk_widget_get_realized (widget)) { if (gtk_widget_get_mapped (widget)) { window_visible = allocation->width > 0 && allocation->height > 0; if (!window_visible && gdk_window_is_visible (priv->view_window)) gdk_window_hide (priv->view_window); if (window_visible && !gdk_window_is_visible (priv->view_window)) gdk_window_show (priv->view_window); } gdk_window_move_resize (priv->view_window, allocation->x, allocation->y, allocation->width, allocation->height); bin_x = 0; bin_y = 0; transition = effective_transition (revealer); if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN) bin_y = allocation->height - child_allocation.height; else if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) bin_x = allocation->width - child_allocation.width; gdk_window_move_resize (priv->bin_window, bin_x, bin_y, child_allocation.width, child_allocation.height); } }
static void place_windows (GtkIconEntry *icon_entry, GtkAllocation *widget_alloc) { GtkIconEntryPosition left_icon_pos; GtkIconEntryPosition right_icon_pos; GtkAllocation left_icon_alloc; GtkAllocation right_icon_alloc; GtkAllocation text_area_alloc; GtkIconEntryPrivate *priv; gint y; priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry); get_text_area_size (icon_entry, &text_area_alloc); /* DJW center text/icon * TODO flicker needs to be eliminated */ gdk_window_get_geometry (GTK_ENTRY (icon_entry)->text_area, NULL, &y, NULL, NULL, NULL); text_area_alloc.y = y; get_icon_allocation (icon_entry, TRUE, widget_alloc, &text_area_alloc, &left_icon_alloc, &left_icon_pos); get_icon_allocation (icon_entry, FALSE, widget_alloc, &text_area_alloc, &right_icon_alloc, &right_icon_pos); if (left_icon_alloc.width > 0) { text_area_alloc.x = left_icon_alloc.x + left_icon_alloc.width + ICON_MARGIN; } if (right_icon_alloc.width > 0) { text_area_alloc.width -= right_icon_alloc.width + ICON_MARGIN; } text_area_alloc.width -= text_area_alloc.x; gdk_window_move_resize (priv->icons[left_icon_pos].window, left_icon_alloc.x, left_icon_alloc.y, left_icon_alloc.width, left_icon_alloc.height); gdk_window_move_resize (priv->icons[right_icon_pos].window, right_icon_alloc.x, right_icon_alloc.y, right_icon_alloc.width, right_icon_alloc.height); gdk_window_move_resize (GTK_ENTRY (icon_entry)->text_area, text_area_alloc.x, text_area_alloc.y, text_area_alloc.width, text_area_alloc.height); }
static void gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { GList *tmp_list; GtkForm *form; gboolean need_reposition; GtkAllocation cur_alloc; g_return_if_fail(GTK_IS_FORM(widget)); gtk_widget_get_allocation(widget, &cur_alloc); if (cur_alloc.x == allocation->x && cur_alloc.y == allocation->y && cur_alloc.width == allocation->width && cur_alloc.height == allocation->height) return; need_reposition = cur_alloc.width != allocation->width || cur_alloc.height != allocation->height; form = GTK_FORM(widget); if (need_reposition) { tmp_list = form->children; while (tmp_list) { GtkFormChild *child = tmp_list->data; gtk_form_position_child(form, child, TRUE); tmp_list = tmp_list->next; } } if (gtk_widget_get_realized(widget)) { gdk_window_move_resize(gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_move_resize(GTK_FORM(widget)->bin_window, 0, 0, allocation->width, allocation->height); } gtk_widget_set_allocation(widget, allocation); if (need_reposition) gtk_form_send_configure(form); }
static void move_locate_pointer_window (GsdLocatePointerData *data, GdkScreen *screen) { gint cursor_x, cursor_y; GdkBitmap *mask; GdkColor col; GdkGC *gc; gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); gdk_window_move_resize (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2, WINDOW_SIZE, WINDOW_SIZE); col.pixel = 0; mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1); gc = gdk_gc_new (mask); gdk_gc_set_foreground (gc, &col); gdk_draw_rectangle (mask, gc, TRUE, 0, 0, WINDOW_SIZE, WINDOW_SIZE); /* allow events to happen through the window */ gdk_window_input_shape_combine_mask (data->window, mask, 0, 0); g_object_unref (mask); g_object_unref (gc); }
static void gtk_button_allocate (GtkCssGadget *gadget, const GtkAllocation *allocation, int baseline, GtkAllocation *out_clip, gpointer unused) { GtkWidget *widget; GtkWidget *child; widget = gtk_css_gadget_get_owner (gadget); child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) gtk_widget_size_allocate_with_baseline (child, (GtkAllocation *)allocation, baseline); if (gtk_widget_get_realized (widget)) { GtkAllocation border_allocation; gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL); gdk_window_move_resize (GTK_BUTTON (widget)->priv->event_window, border_allocation.x, border_allocation.y, border_allocation.width, border_allocation.height); } gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip); }
static void move_locate_pointer_window (GsdLocatePointerData *data, GdkScreen *screen) { cairo_region_t *region; gint cursor_x, cursor_y; // // gdk_window_get_pointer (gdk_screen_get_root_window (screen), // &cursor_x, &cursor_y, NULL); // use gdk_device_get_position instead of gdk_window_get_device_position // 'coz we use root window here. GdkDisplay *display; GdkDeviceManager * device_manager; GdkDevice* pointer_device; display = gdk_window_get_display (data->window); device_manager = gdk_display_get_device_manager (display); pointer_device = gdk_device_manager_get_client_pointer (device_manager); gdk_device_get_position (pointer_device, NULL, &cursor_x, &cursor_y); // gdk_window_move_resize (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2, WINDOW_SIZE, WINDOW_SIZE); /* allow events to happen through the window */ region = cairo_region_create (); gdk_window_input_shape_combine_region (data->window, region, 0, 0); cairo_region_destroy (region); }
void xmms_fullscreen_leave(GtkWidget * win) { fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); if (fwin->is_full && fwin->display->is_full) { /* Release our grabs */ gdk_pointer_ungrab(GDK_CURRENT_TIME); gdk_keyboard_ungrab(GDK_CURRENT_TIME); /* Let the WM manage this window again */ gdk_window_hide(fwin->window->window); gdk_window_set_override_redirect(fwin->window->window, FALSE); gdk_window_show(fwin->window->window); /* Restore size/position */ gdk_window_move_resize(fwin->window->window, fwin->ox, fwin->oy, fwin->owidth, fwin->oheight); XF86VidModeSwitchToMode(fwin->display->display, DefaultScreen(fwin->display->display), fwin->display->origmode); fwin->display->is_full = FALSE; } fwin->is_full = FALSE; FULL_UNLOCK(); }
void moz_drawingarea_move_resize (MozDrawingarea *drawingarea, gint x, gint y, gint width, gint height) { gdk_window_resize(drawingarea->inner_window, width, height); gdk_window_move_resize(drawingarea->clip_window, x, y, width, height); }
void meta_image_window_set (MetaImageWindow *iw, GdkPixbuf *pixbuf, int x, int y) { /* We use a back pixmap to avoid having to handle exposes, because * it's really too slow for large clients being minimized, etc. * and this way flicker is genuinely zero. */ gdk_draw_pixbuf (iw->pixmap, iw->window->style->black_gc, pixbuf, 0, 0, 0, 0, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), GDK_RGB_DITHER_NORMAL, 0, 0); gdk_window_set_back_pixmap (iw->window->window, iw->pixmap, FALSE); gdk_window_move_resize (iw->window->window, x, y, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf)); gdk_window_clear (iw->window->window); }
void _shell_embedded_window_allocate (ShellEmbeddedWindow *window, int x, int y, int width, int height) { GtkAllocation allocation; g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window)); if (window->priv->position.x == x && window->priv->position.y == y && window->priv->position.width == width && window->priv->position.height == height) return; window->priv->position.x = x; window->priv->position.y = y; window->priv->position.width = width; window->priv->position.height = height; if (gtk_widget_get_realized (GTK_WIDGET (window))) gdk_window_move_resize (gtk_widget_get_window (GTK_WIDGET (window)), x, y, width, height); allocation.x = 0; allocation.y = 0; allocation.width = width; allocation.height = height; gtk_widget_size_allocate (GTK_WIDGET (window), &allocation); }
static void gd_tagged_entry_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GdTaggedEntry *self = GD_TAGGED_ENTRY (widget); gint x, y, width, height; GdTaggedEntryTag *tag; GList *l; gtk_widget_set_allocation (widget, allocation); GTK_WIDGET_CLASS (gd_tagged_entry_parent_class)->size_allocate (widget, allocation); if (gtk_widget_get_realized (widget)) { gd_tagged_entry_tag_panel_get_position (self, &x, &y); for (l = self->tags; l != NULL; l = l->next) { GtkBorder margin; tag = l->data; gd_tagged_entry_tag_get_size (tag, self, &width, &height); gd_tagged_entry_tag_get_margin (tag, self, &margin); gdk_window_move_resize (tag->window, x, y + margin.top, width, height); x += width; } gtk_widget_queue_draw (widget); } }
static void gtk_anim_label_size_allocate(GtkWidget * widget, GtkAllocation * allocation ) { PangoRectangle prect; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_ANIM_LABEL(widget)); g_return_if_fail(allocation != NULL); widget->allocation = *allocation; (*GTK_WIDGET_CLASS(parent_class)->size_allocate) (widget, allocation); if (GTK_WIDGET_REALIZED(widget)) { gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); if (((GTK_ANIM_LABEL(widget)->animate) || (GTK_ANIM_LABEL(widget)->auto_animate)) && (GTK_ANIM_LABEL(widget)->layout)) { pango_layout_get_extents(GTK_ANIM_LABEL(widget)->layout, NULL, &prect); if (PANGO_PIXELS(prect.width) < widget->allocation.width) { GTK_ANIM_LABEL(widget)->pos_x = 0; gtk_anim_label_animate(GTK_ANIM_LABEL(widget), FALSE); } else if ((GTK_ANIM_LABEL(widget)->auto_animate) && (!GTK_ANIM_LABEL(widget)->animate)) { GTK_ANIM_LABEL(widget)->pos_x = 0; gtk_anim_label_animate(GTK_ANIM_LABEL(widget), TRUE); } } } }
static void gcal_event_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GcalEventWidget *self; GtkAllocation old_allocation; self = GCAL_EVENT_WIDGET (widget); gtk_widget_get_allocation (widget, &old_allocation); if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (self->event_window, allocation->x, allocation->y, allocation->width, allocation->height); } GTK_WIDGET_CLASS (gcal_event_widget_parent_class)->size_allocate (widget, allocation); /* * Only after the child widgets (main grid, labels, etc) are allocated with the parent * class' allocation function, we can check if the current height is enough to hold the * vertical labels. */ if (old_allocation.width != allocation->width || old_allocation.height != allocation->height) { if (self->orientation == GTK_ORIENTATION_HORIZONTAL || gcal_event_get_all_day (self->event)) return; queue_set_vertical_labels (self, can_hold_vertical_labels_with_height (self, allocation->height)); } }
static void gtk_hex_entry_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkHexEntry *hex_entry; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_HEX_ENTRY (widget)); g_return_if_fail (allocation != NULL); widget->allocation = *allocation; hex_entry = GTK_HEX_ENTRY (widget); if (GTK_WIDGET_REALIZED (widget)) { GtkRequisition requisition; gtk_widget_get_child_requisition (widget, &requisition); gdk_window_move_resize (widget->window, allocation->x, allocation->y, requisition.width, requisition.height); queue_draw (hex_entry); } }
void FrameGdk::setFrameGeometry(const IntRect &r) { if (!m_drawable || !GDK_IS_WINDOW(m_drawable)) return; GdkWindow* window = GDK_WINDOW(m_drawable); gdk_window_move_resize(window, r.x(), r.y(), r.width(), r.height()); }
static void move_locate_pointer_window (MsdLocatePointerData *data, GdkScreen *screen) { gint cursor_x, cursor_y; GdkBitmap *mask; cairo_t *cr; gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); gdk_window_move_resize (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2, WINDOW_SIZE, WINDOW_SIZE); mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1); cr = gdk_cairo_create (mask); cairo_set_source_rgb (cr, 0., 0., 0.); cairo_rectangle (cr, 0., 0., WINDOW_SIZE, WINDOW_SIZE); cairo_fill (cr); cairo_destroy (cr); /* allow events to happen through the window */ gdk_window_input_shape_combine_mask (data->window, mask, 0, 0); g_object_unref (mask); }
static void gstyle_color_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GstyleColorWidget *self = (GstyleColorWidget *)widget; GtkAllocation child_allocation; g_assert (GSTYLE_IS_COLOR_WIDGET (self)); gtk_widget_set_allocation (widget, allocation); if (self->label && gtk_widget_get_visible (GTK_WIDGET (self->label))) { child_allocation.x = 0; child_allocation.y = 0; child_allocation.width = allocation->width; child_allocation.height = allocation->height; gtk_widget_size_allocate (GTK_WIDGET (self->label), &child_allocation); } if (gtk_widget_get_realized (widget)) gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); }
static void gimp_ruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GimpRuler *ruler = GIMP_RULER (widget); GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler); GtkAllocation widget_allocation; gboolean resized; gtk_widget_get_allocation (widget, &widget_allocation); resized = (widget_allocation.width != allocation->width || widget_allocation.height != allocation->height); gtk_widget_set_allocation (widget, allocation); if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (priv->input_window, allocation->x, allocation->y, allocation->width, allocation->height); if (resized) gimp_ruler_make_pixmap (ruler); } }
static void awt_gtk_panel_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { AWTGtkPanel *panel = AWT_GTK_PANEL(widget); GtkWidget *child; GList *children; GtkAllocation childAllocation; g_return_if_fail (widget != NULL); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); children = panel->children; /* It is a requiremnt in Gtk that when a container is allocated a size it must call gtk_widget_size_allocate for all its children. As we don't want to do layout of widgets in this custom container we simply ask the child to allocate its size and position using its current size and position (thus not affecting the layout). */ while (children) { child = children->data; childAllocation = child->allocation; gtk_widget_size_allocate (child, &childAllocation); children = children->next; } }
static void gtk_tool_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkToolItem *toolitem = GTK_TOOL_ITEM (widget); GtkAllocation child_allocation; gint border_width; GtkWidget *child = GTK_BIN (widget)->child; widget->allocation = *allocation; border_width = GTK_CONTAINER (widget)->border_width; if (toolitem->priv->drag_window) gdk_window_move_resize (toolitem->priv->drag_window, widget->allocation.x + border_width, widget->allocation.y + border_width, widget->allocation.width - border_width * 2, widget->allocation.height - border_width * 2); if (child && gtk_widget_get_visible (child)) { child_allocation.x = allocation->x + border_width; child_allocation.y = allocation->y + border_width; child_allocation.width = allocation->width - 2 * border_width; child_allocation.height = allocation->height - 2 * border_width; gtk_widget_size_allocate (child, &child_allocation); } }
static void rb_vis_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { RBVisWidget *rbvw = RB_VIS_WIDGET (widget); gtk_widget_set_allocation (widget, allocation); if (!gtk_widget_get_realized (widget)) return; rb_debug ("handling size allocate event ([%d,%d] - [%d,%d])", allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); if (rbvw->width != allocation->width) { rbvw->width = allocation->width; g_object_notify (G_OBJECT (rbvw), "width"); } if (rbvw->height != allocation->height) { rbvw->height = allocation->height; g_object_notify (G_OBJECT (rbvw), "height"); } }
static void gtk_switch_allocate_contents (GtkCssGadget *gadget, const GtkAllocation *allocation, int baseline, GtkAllocation *out_clip, gpointer unused) { GtkSwitch *self = GTK_SWITCH (gtk_css_gadget_get_owner (gadget)); GtkSwitchPrivate *priv = self->priv; GtkAllocation slider_alloc; slider_alloc.x = allocation->x + round (priv->handle_pos * (allocation->width - allocation->width / 2)); slider_alloc.y = allocation->y; slider_alloc.width = allocation->width / 2; slider_alloc.height = allocation->height; gtk_css_gadget_allocate (priv->slider_gadget, &slider_alloc, baseline, out_clip); if (gtk_widget_get_realized (GTK_WIDGET (self))) { GtkAllocation border_allocation; gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL); gdk_window_move_resize (priv->event_window, border_allocation.x, border_allocation.y, border_allocation.width, border_allocation.height); } }
static void hildon_color_chooser_size_allocate (GtkWidget *widget, GtkAllocation *alloc) { HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (widget); GtkBorder outer, inner; g_assert (priv); widget->allocation = *alloc; init_borders(widget, &inner, &outer); priv->hba.height = alloc->height - outer.top - outer.bottom; priv->hba.y = alloc->y + outer.top; priv->hba.width = inner.top; priv->hba.x = alloc->x + alloc->width - outer.right - inner.top; priv->spa.x = alloc->x + outer.left; priv->spa.y = alloc->y + outer.top; priv->spa.height = alloc->height - outer.top - outer.bottom; priv->spa.width = alloc->width - outer.left - outer.right - inner.top - inner.bottom; if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (priv->event_window, widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height); } }