void _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen, gint scale) { GList *toplevels, *l; GdkWindow *root; if (x11_screen->window_scale == scale) return; x11_screen->window_scale = scale; root = x11_screen->root_window; GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale; toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen)); for (l = toplevels; l != NULL; l = l->next) { GdkWindow *window = l->data; _gdk_x11_window_set_window_scale (window, scale); } g_signal_emit_by_name (GDK_SCREEN (x11_screen), "monitors-changed"); }
void _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen, gint scale) { GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display); GList *toplevels, *l; GdkWindow *root; int i; if (x11_screen->window_scale == scale) return; x11_screen->window_scale = scale; root = x11_screen->root_window; GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale; toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen)); for (l = toplevels; l != NULL; l = l->next) { GdkWindow *window = l->data; _gdk_x11_window_set_window_scale (window, scale); } for (i = 0; i < x11_display->monitors->len; i++) { GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]); gdk_monitor_set_scale_factor (monitor, scale); } g_signal_emit_by_name (GDK_SCREEN (x11_screen), "monitors-changed"); }
static void gdk_x11_screen_dispose (GObject *object) { GdkX11Screen *x11_screen = GDK_X11_SCREEN (object); int i; for (i = 0; i < 32; ++i) { if (x11_screen->subwindow_gcs[i]) { XFreeGC (x11_screen->xdisplay, x11_screen->subwindow_gcs[i]); x11_screen->subwindow_gcs[i] = 0; } } _gdk_x11_screen_events_uninit (GDK_SCREEN (object)); if (x11_screen->root_window) _gdk_window_destroy (x11_screen->root_window, TRUE); G_OBJECT_CLASS (gdk_x11_screen_parent_class)->dispose (object); x11_screen->xdisplay = NULL; x11_screen->xscreen = NULL; x11_screen->screen_num = -1; x11_screen->xroot_window = None; x11_screen->wmspec_check_window = None; }
static void drive_poll_for_media_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { GdkScreen *screen; GError *error; char *primary; char *name; error = NULL; if (!g_drive_poll_for_media_finish (G_DRIVE (source_object), res, &error)) { if (error->code != G_IO_ERROR_FAILED_HANDLED) { screen = GDK_SCREEN (user_data); name = g_drive_get_name (G_DRIVE (source_object)); primary = g_strdup_printf (_("Unable to scan %s for media changes"), name); g_free (name); panel_error_dialog (NULL, screen, "cannot_scan_drive", TRUE, primary, error->message); g_free (primary); } g_error_free (error); } //FIXME: should we mount the volume and activate the root of the new //mount? }
void _gdk_x11_xsettings_init (GdkX11Screen *x11_screen) { gdk_window_add_filter (gdk_screen_get_root_window (GDK_SCREEN (x11_screen)), gdk_xsettings_root_window_filter, x11_screen); check_manager_window (x11_screen, FALSE); }
static VALUE rg_find_window(int argc, VALUE *argv, VALUE self) { VALUE drag_window, x_root, y_root; GdkWindow *dest_window; GdkDragProtocol prot; if (argc == 3) { rb_scan_args(argc, argv, "30", &drag_window, &x_root, &y_root); gdk_drag_find_window(_SELF(self), GDK_WINDOW(RVAL2GOBJ(drag_window)), NUM2INT(x_root), NUM2INT(y_root), &dest_window, &prot); } else { VALUE screen; rb_scan_args(argc, argv, "40", &drag_window, &screen, &x_root, &y_root); gdk_drag_find_window_for_screen(_SELF(self), GDK_WINDOW(RVAL2GOBJ(drag_window)), GDK_SCREEN(RVAL2GOBJ(screen)), NUM2INT(x_root), NUM2INT(y_root), &dest_window, &prot); } return rb_ary_new3(2, GOBJ2RVAL(dest_window), GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL)); }
int clip_GTK_INVISIBLENEWFORSCREEN(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); C_object *cscreen = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); C_widget *cwid = NULL; GtkWidget *wid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKCOBJ(cscreen, GDK_IS_SCREEN(cscreen->object)); wid = gtk_invisible_new_for_screen(GDK_SCREEN(cscreen->object)); if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
static void gtk_timeline_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkTimeline *timeline; timeline = GTK_TIMELINE (object); switch (prop_id) { case PROP_FPS: _gtk_timeline_set_fps (timeline, g_value_get_uint (value)); break; case PROP_DURATION: _gtk_timeline_set_duration (timeline, g_value_get_uint (value)); break; case PROP_LOOP: _gtk_timeline_set_loop (timeline, g_value_get_boolean (value)); break; case PROP_DIRECTION: _gtk_timeline_set_direction (timeline, g_value_get_enum (value)); break; case PROP_SCREEN: _gtk_timeline_set_screen (timeline, GDK_SCREEN (g_value_get_object (value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void gdk_screen_finalize (GObject *object) { GdkScreen *screen = GDK_SCREEN (object); if (screen->font_options) cairo_font_options_destroy (screen->font_options); G_OBJECT_CLASS (gdk_screen_parent_class)->finalize (object); }
static int lglext_config_new_by_mode_for_screen(lua_State* L) { luaL_checktype(L, 1, LUA_TUSERDATA); luaL_checktype(L, 2, LUA_TNUMBER); Object* obj = lua_touserdata(L, 1); GdkGLConfig* ptr = gdk_gl_config_new_by_mode_for_screen( GDK_SCREEN(obj->pointer), lua_tointeger(L, 2)); object_new(L, ptr, TRUE); return 1; }
static VALUE rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE screen; GdkScreen* gscreen; rb_scan_args(argc, argv, "01", &screen); if (NIL_P(screen)){ gscreen = gdk_screen_get_default(); } else { gscreen = GDK_SCREEN(RVAL2GOBJ(screen)); } return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen)); }
static void gdk_gix_screen_finalize (GObject *object) { GdkScreenGix *screen_gix = GDK_SCREEN_GIX (object); if (screen_gix->root_window) g_object_unref (screen_gix->root_window); /* Visual Part */ g_object_unref (system_visual); deinit_multihead (GDK_SCREEN (object)); G_OBJECT_CLASS (_gdk_screen_gix_parent_class)->finalize (object); }
int clip_GTK_ICONTHEMESETSCREEN(ClipMachine * cm) { C_object *cicon = _fetch_co_arg(cm); C_object *cscreen = _fetch_cobject(cm, _clip_spar(cm, 2)); CHECKCOBJ(cicon, GTK_IS_ICON_THEME(cicon->object)); CHECKCOBJ(cscreen, GDK_IS_SCREEN(cscreen->object)); gtk_icon_theme_set_screen(GTK_ICON_THEME(cicon->object), GDK_SCREEN(cscreen->object)); return 0; err: return 1; }
int clip_GTK_INVISIBLESETSCREEN(ClipMachine * ClipMachineMemory) { C_widget *cinvis = _fetch_cw_arg(ClipMachineMemory); C_object *cscreen = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); CHECKCWID(cinvis, GTK_IS_INVISIBLE); CHECKCOBJ(cscreen, GDK_IS_SCREEN(cscreen->object)); gtk_invisible_set_screen(GTK_INVISIBLE(cinvis->widget), GDK_SCREEN(cscreen->object)); return 0; err: return 1; }
/** * thunar_util_parse_parent: * @parent : a #GtkWidget, a #GdkScreen or %NULL. * @window_return : return location for the toplevel #GtkWindow or * %NULL. * * Determines the screen for the @parent and returns that #GdkScreen. * If @window_return is not %NULL, the pointer to the #GtkWindow is * placed into it, or %NULL if the window could not be determined. * * Return value: the #GdkScreen for the @parent. **/ GdkScreen* thunar_util_parse_parent (gpointer parent, GtkWindow **window_return) { GdkScreen *screen; GtkWidget *window = NULL; _thunar_return_val_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent), NULL); /* determine the proper parent */ if (parent == NULL) { /* just use the default screen then */ screen = gdk_screen_get_default (); } else if (GDK_IS_SCREEN (parent)) { /* yep, that's a screen */ screen = GDK_SCREEN (parent); } else { /* parent is a widget, so let's determine the toplevel window */ window = gtk_widget_get_toplevel (GTK_WIDGET (parent)); if (window != NULL && gtk_widget_is_toplevel (window)) { /* make sure the toplevel window is shown */ gtk_widget_show_now (window); } else { /* no toplevel, not usable then */ window = NULL; } /* determine the screen for the widget */ screen = gtk_widget_get_screen (GTK_WIDGET (parent)); } /* check if we should return the window */ if (G_LIKELY (window_return != NULL)) *window_return = (GtkWindow *) window; return screen; }
static VALUE gdkpango_s_context_get(int argc, VALUE *argv, VALUE self) { VALUE screen, ret; rb_scan_args(argc, argv, "01", &screen); if (NIL_P(screen)){ ret = GOBJ2RVAL(gdk_pango_context_get()); } else { #if GTK_CHECK_VERSION(2,2,0) ret = GOBJ2RVAL(gdk_pango_context_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); #else rb_warn("Gdk::Pango.context_get: Not supported arguments in GTK+-2.0.x."); ret = GOBJ2RVAL(gdk_pango_context_get()); #endif } return ret; }
void _gdk_x11_xsettings_finish (GdkX11Screen *x11_screen) { gdk_window_remove_filter (gdk_screen_get_root_window (GDK_SCREEN (x11_screen)), gdk_xsettings_root_window_filter, x11_screen); if (x11_screen->xsettings_manager_window) { gdk_window_remove_filter (x11_screen->xsettings_manager_window, gdk_xsettings_manager_window_filter, x11_screen); g_object_unref (x11_screen->xsettings_manager_window); x11_screen->xsettings_manager_window = NULL; } if (x11_screen->xsettings) { g_hash_table_unref (x11_screen->xsettings); x11_screen->xsettings = NULL; } }
static void gdk_xsettings_notify (GdkX11Screen *x11_screen, const char *name, GdkSettingAction action) { GdkEvent new_event; if (!g_str_has_prefix (name, "gtk-")) return; new_event.type = GDK_SETTING; new_event.setting.window = gdk_screen_get_root_window (GDK_SCREEN (x11_screen)); new_event.setting.send_event = FALSE; new_event.setting.action = action; new_event.setting.name = (char*) name; gdk_event_put (&new_event); }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE screen; GdkScreen* gscreen; rb_scan_args(argc, argv, "01", &screen); if (NIL_P(screen)){ gscreen = gdk_screen_get_default(); } else { gscreen = GDK_SCREEN(RVAL2GOBJ(screen)); } G_INITIALIZE(self, gdk_pango_renderer_new(gscreen)); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE screen; rb_scan_args(argc, argv, "01", &screen); if (argc == 0){ RBGTK_INITIALIZE(self, gtk_invisible_new()); } else { #if GTK_CHECK_VERSION(2,2,0) RBGTK_INITIALIZE(self, gtk_invisible_new_for_screen( GDK_SCREEN(RVAL2GOBJ(screen)))); #else rb_raise(rb_eArgError, "GTK+-2.2 feature. GTK+-2.0.x doesn't support this."); #endif } return Qnil; }
static void gdk_screen_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GdkScreen *screen = GDK_SCREEN (object); switch (prop_id) { case PROP_FONT_OPTIONS: gdk_screen_set_font_options (screen, g_value_get_pointer (value)); break; case PROP_RESOLUTION: gdk_screen_set_resolution (screen, g_value_get_double (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gdk_x11_screen_finalize (GObject *object) { GdkX11Screen *x11_screen = GDK_X11_SCREEN (object); gint i; if (x11_screen->root_window) g_object_unref (x11_screen->root_window); /* Visual Part */ for (i = 0; i < x11_screen->nvisuals; i++) g_object_unref (x11_screen->visuals[i]); g_free (x11_screen->visuals); g_hash_table_destroy (x11_screen->visual_hash); g_free (x11_screen->window_manager_name); deinit_multihead (GDK_SCREEN (object)); G_OBJECT_CLASS (gdk_x11_screen_parent_class)->finalize (object); }
int clip_GTK_ICONTHEMEGETFORSCREEN(ClipMachine * cm) { C_object *cscreen = _fetch_co_arg(cm); C_object *cicon; GtkIconTheme *icon; CHECKCOBJ(cscreen, GDK_IS_SCREEN(cscreen->object)); icon = gtk_icon_theme_get_for_screen(GDK_SCREEN(cscreen->object)); if (icon) { cicon = _list_get_cobject(cm,icon); if (!cicon) cicon = _register_object(cm,icon,GTK_TYPE_ICON_THEME,NULL,NULL); if (cicon) _clip_mclone(cm,RETPTR(cm),&cicon->obj); } return 0; err: return 1; }
static void gdk_screen_dispose (GObject *object) { GdkScreen *screen = GDK_SCREEN (object); gint i; for (i = 0; i < 32; ++i) { if (screen->exposure_gcs[i]) { g_object_unref (screen->exposure_gcs[i]); screen->exposure_gcs[i] = NULL; } if (screen->normal_gcs[i]) { g_object_unref (screen->normal_gcs[i]); screen->normal_gcs[i] = NULL; } } G_OBJECT_CLASS (gdk_screen_parent_class)->dispose (object); }
static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_recent_manager_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; }
static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_recent_manager_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); }
static VALUE it_set_screen(VALUE self, VALUE screen) { gtk_icon_theme_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; }
static VALUE it_get_for_screen(VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_icon_theme_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); }
static void fetch_net_wm_check_window (GdkScreen *screen) { GdkX11Screen *x11_screen; GdkDisplay *display; Atom type; gint format; gulong n_items; gulong bytes_after; guchar *data; Window *xwindow; GTimeVal tv; gint error; x11_screen = GDK_X11_SCREEN (screen); display = x11_screen->display; g_return_if_fail (GDK_X11_DISPLAY (display)->trusted_client); g_get_current_time (&tv); if (ABS (tv.tv_sec - x11_screen->last_wmspec_check_time) < 15) return; /* we've checked recently */ x11_screen->last_wmspec_check_time = tv.tv_sec; data = NULL; XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window, gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"), 0, G_MAXLONG, False, XA_WINDOW, &type, &format, &n_items, &bytes_after, &data); if (type != XA_WINDOW) { if (data) XFree (data); return; } xwindow = (Window *)data; if (x11_screen->wmspec_check_window == *xwindow) { XFree (xwindow); return; } gdk_x11_display_error_trap_push (display); /* Find out if this WM goes away, so we can reset everything. */ XSelectInput (x11_screen->xdisplay, *xwindow, StructureNotifyMask); error = gdk_x11_display_error_trap_pop (display); if (!error) { x11_screen->wmspec_check_window = *xwindow; x11_screen->need_refetch_net_supported = TRUE; x11_screen->need_refetch_wm_name = TRUE; /* Careful, reentrancy */ _gdk_x11_screen_window_manager_changed (GDK_SCREEN (x11_screen)); } else if (error == BadWindow) { /* Leftover property, try again immediately, new wm may be starting up */ x11_screen->last_wmspec_check_time = 0; } XFree (xwindow); }
static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_menu_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; }