NS_IMETHODIMP nsScreenManagerGtk :: ScreenForNativeWidget (void *aWidget, nsIScreen **outScreen) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForNativeWidget"); return rv; } if (mCachedScreenArray.Count() > 1) { // I don't know how to go from GtkWindow to nsIScreen, especially // given xinerama and stuff, so let's just do this gint x, y, width, height; #if (MOZ_WIDGET_GTK == 2) gint depth; #endif x = y = width = height = 0; #if (MOZ_WIDGET_GTK == 2) gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height, &depth); #else gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height); #endif gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y); rv = ScreenForRect(x, y, width, height, outScreen); } else { rv = GetPrimaryScreen(outScreen); } return rv; }
static void cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv) { GdkWindow *parent_win; GtkAdjustment *adj; GtkWidget *inner; gint viewport_size; inner = ((tabview *)cv)->inner; parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); if (cv->vertical) { adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner))); gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0); } else { adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner))); gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0); } if (gtk_adjustment_get_upper (adj) <= viewport_size) { gtk_widget_hide (((tabview *)cv)->b1); gtk_widget_hide (((tabview *)cv)->b2); } else { gtk_widget_show (((tabview *)cv)->b1); gtk_widget_show (((tabview *)cv)->b2); } }
/** * Resize window to accommodate maximum number of address entries. * \param cw Completion window. */ static void addrcompl_resize_window( CompletionWindow *cw ) { GtkRequisition r; gint x, y, width, height, depth; /* Get current geometry of window */ #if !GTK_CHECK_VERSION(3, 0, 0) gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height, &depth ); #else gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height ); #endif gtk_widget_queue_resize_no_redraw(cw->list_view); gtk_widget_size_request( cw->list_view, &r ); /* Adjust window height to available screen space */ if( y + r.height > gdk_screen_height()) r.height = gdk_screen_height() - y; gtk_widget_set_size_request(cw->window, width, r.height); gdk_pointer_grab(gtk_widget_get_window(cw->window), TRUE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, GDK_CURRENT_TIME); gdk_keyboard_grab(gtk_widget_get_window(cw->window), FALSE, GDK_CURRENT_TIME); gtk_grab_add(cw->window); }
static void get_menu_pos (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) { charpick_data *curr_data = data; GtkRequisition reqmenu; gint tempx, tempy, width, height; gint screen_width, screen_height; gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &reqmenu); gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), &tempx, &tempy); gdk_window_get_geometry (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), NULL, NULL, &width, &height ); switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (curr_data->applet))) { case MATE_PANEL_APPLET_ORIENT_DOWN: tempy += height; break; case MATE_PANEL_APPLET_ORIENT_UP: tempy -= reqmenu.height; break; case MATE_PANEL_APPLET_ORIENT_LEFT: tempx -= reqmenu.width; break; case MATE_PANEL_APPLET_ORIENT_RIGHT: tempx += width; break; } gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), NULL, NULL, &screen_width, &screen_height); *x = CLAMP (tempx, 0, MAX (0, screen_width - reqmenu.width)); *y = CLAMP (tempy, 0, MAX (0, screen_height - reqmenu.height)); }
void uim_cand_win_horizontal_gtk_layout_sub_window(UIMCandWinHorizontalGtk *horizontal_cwin) { UIMCandWinGtk *cwin; #if GTK_CHECK_VERSION(2, 90, 0) gint x, y, w, h, x2, y2, w2, h2, x3, y3; #else gint x, y, w, h, d, x2, y2, w2, h2, d2, x3, y3; #endif struct index_button *idxbutton; g_return_if_fail(UIM_IS_CAND_WIN_HORIZONTAL_GTK(horizontal_cwin)); cwin = UIM_CAND_WIN_GTK(horizontal_cwin); if (!cwin->sub_window.window) return; #if GTK_CHECK_VERSION(2, 90, 0) gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y, &w, &h); #else gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y, &w, &h, &d); #endif gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y); #if GTK_CHECK_VERSION(2, 90, 0) gdk_window_get_geometry(gtk_widget_get_window(cwin->sub_window.window), &x2, &y2, &w2, &h2); #else gdk_window_get_geometry(gtk_widget_get_window(cwin->sub_window.window), &x2, &y2, &w2, &h2, &d2); #endif if (horizontal_cwin->selected) { GtkWidget *button; idxbutton = horizontal_cwin->selected; button = GTK_WIDGET(idxbutton->button); gdk_window_get_origin(gtk_widget_get_window(button), &x3, &y3); #if GTK_CHECK_VERSION(2, 18, 0) if (!gtk_widget_get_has_window(button)) { GtkAllocation allocation; gtk_widget_get_allocation(button, &allocation); x3 += allocation.x; } #else if (GTK_WIDGET_NO_WINDOW(button)) x3 += button->allocation.x; #endif } y = y + h; gtk_window_move(GTK_WINDOW(cwin->sub_window.window), x3, y); }
void uim_cand_win_gtk_real_layout_sub_window(UIMCandWinGtk *cwin) { #if GTK_CHECK_VERSION(2, 90, 0) gint x, y, w, h, sw, sh, x2, y2, w2, h2; #else gint x, y, w, h, d, sw, sh, x2, y2, w2, h2, d2; #endif GdkRectangle rect; GtkTreePath *path; GtkTreeViewColumn *focus_column; if (!cwin->sub_window.window) return; gtk_tree_view_get_cursor(GTK_TREE_VIEW(cwin->view), &path, &focus_column); gtk_tree_view_get_cell_area(GTK_TREE_VIEW(cwin->view), path, NULL, &rect); gtk_tree_path_free(path); #if GTK_CHECK_VERSION(2, 90, 0) gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y, &w, &h); #else gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y, &w, &h, &d); #endif gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y); sw = gdk_screen_get_width (gdk_screen_get_default ()); sh = gdk_screen_get_height (gdk_screen_get_default ()); #if GTK_CHECK_VERSION(2, 90, 0) gdk_window_get_geometry(gtk_widget_get_window(cwin->sub_window.window), &x2, &y2, &w2, &h2); #else gdk_window_get_geometry(gtk_widget_get_window(cwin->sub_window.window), &x2, &y2, &w2, &h2, &d2); #endif if (x + w + w2 > sw) x = x - w2; else x = x + w; if ((y + rect.y + h2) > sh) y = sh - h2; else y = y + rect.y; gtk_window_move(GTK_WINDOW(cwin->sub_window.window), x, y); }
static void tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv) { GtkAdjustment *adj; gint viewport_size; gfloat new_value; GtkWidget *inner; GdkWindow *parent_win; gdouble i; inner = ((tabview *)cv)->inner; parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner)); if (cv->vertical) { adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner))); gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0); } else { adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner))); gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0); } new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 1, cv->vertical); if (new_value == 0 || new_value + viewport_size > gtk_adjustment_get_upper (adj)) new_value = gtk_adjustment_get_upper (adj) - viewport_size; if (!tab_right_is_moving) { tab_right_is_moving = 1; for (i = gtk_adjustment_get_value (adj); ((i < new_value) && (tab_right_is_moving)); i += 0.1) { gtk_adjustment_set_value (adj, i); while (g_main_context_pending (NULL)) g_main_context_iteration (NULL, TRUE); } gtk_adjustment_set_value (adj, new_value); tab_right_is_moving = 0; /* hSP: set to false in case we didnt get stopped (the normal case) */ } else { tab_right_is_moving = 0; /* hSP: jump directly to next element if user is clicking faster than we can scroll.. */ } }
int wxListBox::DoListHitTest(const wxPoint& point) const { // gtk_tree_view_get_path_at_pos() also gets items that are not visible and // we only want visible items we need to check for it manually here if ( !GetClientRect().Contains(point) ) return wxNOT_FOUND; // need to translate from master window since it is in client coords gint binx, biny; gdk_window_get_geometry(gtk_tree_view_get_bin_window(m_treeview), &binx, &biny, NULL, NULL); wxGtkTreePath path; if ( !gtk_tree_view_get_path_at_pos ( m_treeview, point.x - binx, point.y - biny, path.ByRef(), NULL, // [out] column (always 0 here) NULL, // [out] x-coord relative to the cell (not interested) NULL // [out] y-coord relative to the cell ) ) { return wxNOT_FOUND; } return gtk_tree_path_get_indices(path)[0]; }
/** * gdk_screen_get_monitor_at_window: * @screen: a #GdkScreen. * @window: a #GdkWindow * @returns: the monitor number in which most of @window is located, * or if @window does not intersect any monitors, a monitor, * close to @window. * * Returns the number of the monitor in which the largest area of the * bounding rectangle of @window resides. * * Since: 2.2 **/ gint gdk_screen_get_monitor_at_window (GdkScreen *screen, GdkWindow *window) { gint num_monitors, i, area = 0, screen_num = -1; GdkRectangle win_rect; g_return_val_if_fail (GDK_IS_SCREEN (screen), -1); gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height, NULL); gdk_window_get_origin (window, &win_rect.x, &win_rect.y); num_monitors = gdk_screen_get_n_monitors (screen); for (i=0;i<num_monitors;i++) { GdkRectangle tmp_monitor, intersect; gdk_screen_get_monitor_geometry (screen, i, &tmp_monitor); gdk_rectangle_intersect (&win_rect, &tmp_monitor, &intersect); if (intersect.width * intersect.height > area) { area = intersect.width * intersect.height; screen_num = i; } } if (screen_num >= 0) return screen_num; else return get_nearest_monitor (screen, win_rect.x + win_rect.width / 2, win_rect.y + win_rect.height / 2); }
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetBounds (JNIEnv *env, jobject obj) { jclass rectangle_class; jmethodID rectangle_ctor; GdkScreen *screen; GdkWindow *window; int x, y, w, h; jobject instance; rectangle_class = (*env)->FindClass(env, "java/awt/Rectangle"); rectangle_ctor = (*env)->GetMethodID (env, rectangle_class, "<init>", "(IIII)V"); screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj); gdk_threads_enter(); window = gdk_screen_get_root_window(screen); gdk_window_get_geometry(window, &x, &y, &w, &h, NULL); gdk_threads_leave(); instance = (*env)->NewObject(env, rectangle_class, rectangle_ctor, x, y, w, h); return instance; }
// Handler für seeking gboolean on_range_song_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { g_debug ("Progress Button pressed!"); gint x, y, breite, hoehe, tiefe; gint64 position; gint64 duration; gdouble barpos; gdk_window_get_geometry (GDK_WINDOW(event->window), &x, &y, &breite, &hoehe, &tiefe); barpos = (gdouble) event->x / breite; //g_debug("\tbreite=%i, position=%f, barpos=%f", breite, event->x, barpos); duration = player_get_duration(); // seekposition berechnen position = duration * barpos; // Slider Position temporär setzen interface_set_song_position (position); //g_debug("\tduration=%"G_GINT64_FORMAT", position=%"G_GINT64_FORMAT"", duration, position); player_seek_to_position (position); return FALSE; }
static void sn_item_get_action_coordinates (SnItem *item, gint *x, gint *y) { GtkWidget *widget; SnItemPrivate *priv; GdkWindow *window; GtkWidget *toplevel; gint width; gint height; priv = sn_item_get_instance_private (item); widget = GTK_WIDGET (item); window = gtk_widget_get_window (widget); toplevel = gtk_widget_get_toplevel (widget); gdk_window_get_geometry (window, x, y, &width, &height); gtk_widget_translate_coordinates (widget, toplevel, *x, *y, x, y); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) *y += height; else *x += width; }
void gs_theme_engine_get_window_size (GSThemeEngine *engine, int *width, int *height) { if (width != NULL) { *width = 0; } if (height != NULL) { *height = 0; } g_return_if_fail (GS_IS_THEME_ENGINE (engine)); if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (engine))) { return; } gdk_window_get_geometry (GTK_WIDGET (engine)->window, NULL, NULL, width, height, NULL); }
bool TooltipTT::adust_in_screen(gint& x, gint& y, GdkWindow* win) { bool in_screen = true ; //> get gdk window largeur gint gdkwin_width, gdkwin_height, gdkwin_depth ; gint gdkwinx, gdkwiny; gdk_window_get_geometry(win, &gdkwinx, &gdkwiny, &gdkwin_width, &gdkwin_height, &gdkwin_depth) ; gdk_window_get_origin(win, &gdkwinx, &gdkwiny); //> limit of the screen that tooltip mustn't pass over gint limitx = gdkwinx + gdkwin_width ; gint limity = gdkwiny + gdkwin_height ; //> compute max tooltip value gint tooltipWidth, tooltipHeight ; get_size(tooltipWidth, tooltipHeight) ; gint tooltipmaxX = x + tooltipWidth ; gint tooltipmaxY = y + tooltipHeight ; if (tooltipmaxX > limitx) { x = x - tooltipWidth - 10 ; in_screen = false ; } if (tooltipmaxY > limity) { y = y - tooltipHeight - 10 ; in_screen = false ; } return in_screen ; }
bool WaylandEGLContext::attach (GtkWidget *widget) { GdkWindow *window = gtk_widget_get_window (widget); if (!GDK_IS_WAYLAND_WINDOW (window)) return false; gdk_window = window; gdk_window_get_geometry (gdk_window, &x, &y, &width, &height); display = gdk_wayland_display_get_wl_display (gdk_window_get_display (gdk_window)); parent = gdk_wayland_window_get_wl_surface (gdk_window); registry = wl_display_get_registry (display); wl_registry_add_listener (registry, &wl_registry_listener, this); wl_display_roundtrip (display); if (!compositor || !subcompositor) return false; child = wl_compositor_create_surface (compositor); region = wl_compositor_create_region (compositor); subsurface = wl_subcompositor_get_subsurface (subcompositor, child, parent); wl_surface_set_input_region (child, region); wl_subsurface_set_desync (subsurface); wl_subsurface_set_position (subsurface, x, y); return true; }
int LeftMargin::getMarginHeight(GtkTextView *textView) const { GdkWindow *marginWindow = gtk_text_view_get_window(textView, GTK_TEXT_WINDOW_LEFT); int marginWindowHeight; gdk_window_get_geometry(marginWindow, nullptr, nullptr, nullptr, &marginWindowHeight); return marginWindowHeight; }
void drawIR_expose_event(void) { int i; int size; gint width, height; gdk_window_get_geometry(drawIR->window, NULL, NULL, &width, &height, NULL); for (i=0; i < CWIID_IR_SRC_COUNT; i++) { if (ir_data.src[i].valid) { if (ir_data.src[i].size == -1) { size = 3; } else { size = ir_data.src[i].size+1; } gdk_draw_arc(drawIR->window, drawIR->style->fg_gc[GTK_WIDGET_STATE(drawIR)], TRUE, ir_data.src[i].pos[CWIID_X] * width / CWIID_IR_X_MAX, height - ir_data.src[i].pos[CWIID_Y] * height / CWIID_IR_Y_MAX, size, size, 0, 64 * 360); } } }
static void createDrawContext(GtkWidget** widget, GdkWindow** window){ GtkWidget *main_window; GdkWindow *gdk_win; char* xwindow_s = getenv("XSCREENSAVER_WINDOW"); if (xwindow_s != NULL) { // parse out the xid from xscreensaver's env var, which is given as // hex like 0x12023 int xid = (int)strtol(xwindow_s, NULL, 0); // if we are running in xscreensaver mode, use the provided window XID main_window = gtk_window_new(GTK_WINDOW_POPUP); //main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gdk_win = gdk_window_foreign_new(xid); gtk_widget_show_all(main_window); // reparent window of main_window to gdk_win gdk_window_reparent(gtk_widget_get_window(main_window), gdk_win, 0, 0); gint width; gint height; gdk_window_get_geometry(gdk_win, NULL, NULL, &width, &height, NULL); printf("Looks like we are about %dx%d\n",width,height); // Make us cover our parent window gtk_window_move(GTK_WINDOW(main_window), 0, 0); gtk_window_set_default_size(GTK_WINDOW(main_window), width, height); gtk_widget_set_size_request(main_window, width, height); } else { // otherwise just get a normal window main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(main_window), 800, 600); gdk_win = gtk_widget_get_window(main_window); } *widget = main_window; *window = gdk_win; }
void ZLGtkProgressDialog::run(ZLRunnable &runnable) { while (gtk_events_pending()) { gtk_main_iteration(); } GtkWindow *mainWindow = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP)); gtk_window_set_accept_focus(mainWindow, FALSE); myLabel = gtk_label_new(messageText().c_str()); gtk_misc_set_padding(GTK_MISC(myLabel), 10, 10); // something nice? gtk_container_add(GTK_CONTAINER(mainWindow), myLabel); gtk_widget_show_all(GTK_WIDGET(mainWindow)); GdkCursor *cursor = gdk_cursor_new(GDK_WATCH); if (myParent != 0) { gdk_window_set_cursor(GTK_WIDGET(myParent)->window, cursor); } gdk_window_set_cursor(GTK_WIDGET(mainWindow)->window, cursor); gdk_cursor_unref(cursor); int x, y, w, h; if (myParent != 0) { gtk_window_get_position(myParent, &x, &y); gtk_window_get_size(myParent, &w, &h); x += w / 2; y += h / 2; } else { GdkWindow *root = gdk_screen_get_root_window(gdk_screen_get_default()); gdk_window_get_geometry(root, &x, &y, &w, &h, 0); x += w / 2; y += h / 2; } gtk_window_get_size(mainWindow, &w, &h); x -= w / 2; y -= h / 2; gtk_window_move(mainWindow, x, y); while (gtk_events_pending()) { gtk_main_iteration(); } if (myParent != 0) { gtk_widget_queue_draw(GTK_WIDGET(myParent)); } while (gtk_events_pending()) { gtk_main_iteration(); } runnable.run(); myLabel = 0; if (myParent != 0) { gdk_window_set_cursor(GTK_WIDGET(myParent)->window, 0); } gtk_widget_destroy(GTK_WIDGET(mainWindow)); }
bool WaylandEGLContext::create_context () { int scale = gdk_window_get_scale_factor (gdk_window); gdk_window_get_geometry (gdk_window, &x, &y, &width, &height); EGLint surface_attribs[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_RED_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_NONE }; EGLint context_attribs[] = { EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT, EGL_NONE }; EGLint num_configs = 0; if (!subsurface) return false; egl_display = eglGetDisplay ((EGLNativeDisplayType) display); eglInitialize (egl_display, NULL, NULL); if (!eglChooseConfig (egl_display, surface_attribs, &egl_config, 1, &num_configs)) { printf ("Couldn't find matching config.\n"); return false; } eglBindAPI (EGL_OPENGL_API); egl_window = wl_egl_window_create (child, width * scale, height * scale); if (!egl_window) { printf ("Couldn't create window.\n"); return false; } egl_surface = eglCreateWindowSurface (egl_display, egl_config, (EGLNativeWindowType) egl_window, NULL); if (!egl_surface) { printf ("Couldn't create surface.\n"); return false; } egl_context = eglCreateContext (egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); if (!egl_context) { printf ("Couldn't create context.\n"); return false; } wl_surface_set_buffer_scale (child, scale); gdk_window_invalidate_rect (gdk_window, NULL, FALSE); return true; }
static VALUE rg_geometry(VALUE self) { gint x, y, w, h; gdk_window_get_geometry(_SELF(self), &x, &y, &w, &h); return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(w), INT2NUM(h)); }
static VALUE gdkwin_get_geometry(VALUE self) { gint x, y, w, h, d; gdk_window_get_geometry(_SELF(self), &x, &y, &w, &h, &d); return rb_ary_new3(5, INT2NUM(x), INT2NUM(y), INT2NUM(w), INT2NUM(h), INT2NUM(d)); }
static gboolean ghid_pinout_preview_expose (GtkWidget * widget, GdkEventExpose * event) { extern HID ghid_hid; GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget); GdkDrawable *save_drawable; double save_zoom; int da_w, da_h; int save_left, save_top; int save_width, save_height; int save_view_width, save_view_height; double xz, yz; save_zoom = gport->zoom; save_width = gport->width; save_height = gport->height; save_left = gport->view_x0; save_top = gport->view_y0; save_view_width = gport->view_width; save_view_height = gport->view_height; /* Setup drawable and zoom factor for drawing routines */ save_drawable = gport->drawable; gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0); xz = (double) pinout->x_max / da_w; yz = (double) pinout->y_max / da_h; if (xz > yz) gport->zoom = xz; else gport->zoom = yz; gport->drawable = widget->window; gport->width = da_w; gport->height = da_h; gport->view_width = da_w * gport->zoom; gport->view_height = da_h * gport->zoom; gport->view_x0 = (pinout->x_max - gport->view_width) / 2; gport->view_y0 = (pinout->y_max - gport->view_height) / 2; /* clear background */ gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h); /* call the drawing routine */ hid_expose_callback (&ghid_hid, NULL, &pinout->element); gport->drawable = save_drawable; gport->zoom = save_zoom; gport->width = save_width; gport->height = save_height; gport->view_x0 = save_left; gport->view_y0 = save_top; gport->view_width = save_view_width; gport->view_height = save_view_height; return FALSE; }
static cairo_region_t *get_window_region(GdkWindow *window) { cairo_rectangle_int_t rect; memset(&rect, 0, sizeof(rect)); gdk_window_get_geometry(window, NULL, NULL, &rect.width, &rect.height); return cairo_region_create_rectangle (&rect); }
static void gtk_xtbin_realize (GtkWidget *widget) { GtkXtBin *xtbin; GtkAllocation allocation = { 0, 0, 200, 200 }; #if GTK_CHECK_VERSION(2, 18, 0) GtkAllocation widget_allocation; #endif #ifdef DEBUG_XTBIN printf("gtk_xtbin_realize()\n"); #endif g_return_if_fail (GTK_IS_XTBIN (widget)); xtbin = GTK_XTBIN (widget); /* caculate the allocation before realize */ #if GTK_CHECK_VERSION(2, 24, 0) allocation.width = gdk_window_get_width(xtbin->parent_window); allocation.height = gdk_window_get_height(xtbin->parent_window); #else gint x, y, w, h, d; /* geometry of window */ gdk_window_get_geometry(xtbin->parent_window, &x, &y, &w, &h, &d); allocation.width = w; allocation.height = h; #endif gtk_widget_size_allocate (widget, &allocation); #ifdef DEBUG_XTBIN printf("initial allocation %d %d %d %d\n", x, y, w, h); #endif #if GTK_CHECK_VERSION(2, 18, 0) gtk_widget_get_allocation(widget, &widget_allocation); xtbin->width = widget_allocation.width; xtbin->height = widget_allocation.height; #else xtbin->width = widget->allocation.width; xtbin->height = widget->allocation.height; #endif /* use GtkSocket's realize */ (*GTK_WIDGET_CLASS(parent_class)->realize)(widget); /* create the Xt client widget */ xt_client_create(&(xtbin->xtclient), gtk_socket_get_id(GTK_SOCKET(xtbin)), xtbin->height, xtbin->width); xtbin->xtwindow = XtWindow(xtbin->xtclient.child_widget); gdk_flush(); /* now that we have created the xt client, add it to the socket. */ gtk_socket_add_id(GTK_SOCKET(widget), xtbin->xtwindow); }
WKRect PlatformWebView::windowFrame() { GtkAllocation geometry; #ifdef GTK_API_VERSION_2 gint depth; gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(m_window)), &geometry.x, &geometry.y, &geometry.width, &geometry.height, &depth); #else gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(m_window)), &geometry.x, &geometry.y, &geometry.width, &geometry.height); #endif WKRect frame; frame.origin.x = geometry.x; frame.origin.y = geometry.y; frame.size.width = geometry.width; frame.size.height = geometry.height; return frame; }
void WaylandEGLContext::resize () { int scale; gdk_window_get_geometry (gdk_window, &x, &y, &width, &height); scale = gdk_window_get_scale_factor (gdk_window); wl_egl_window_resize (egl_window, width * scale, height * scale, 0, 0); wl_subsurface_set_position (subsurface, x, y); make_current (); }
Rect Ctrl::GetVirtualScreenArea() { GuiLock __; static Rect r; if(r.right == 0) { gint x, y, width, height; gdk_window_get_geometry(gdk_screen_get_root_window(gdk_screen_get_default()), &x, &y, &width, &height, NULL); r = RectC(x, y, width, height); } return r; }
WKRect PlatformWebView::windowFrame() { GtkAllocation geometry; gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(m_window)), &geometry.x, &geometry.y, &geometry.width, &geometry.height); WKRect frame; frame.origin.x = geometry.x; frame.origin.y = geometry.y; frame.size.width = geometry.width; frame.size.height = geometry.height; return frame; }
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); }