static void matekbd_indicator_config_load_colors (MatekbdIndicatorConfig * ind_config) { ind_config->foreground_color = g_settings_get_string (ind_config->settings, MATEKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR); if (ind_config->foreground_color == NULL || ind_config->foreground_color[0] == '\0') { GtkWidgetPath *widget_path = gtk_widget_path_new (); GtkStyleContext *context = gtk_style_context_new (); GdkRGBA fg_color; gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name (widget_path, -1 , "PanelWidget"); gtk_style_context_set_path (context, widget_path); gtk_style_context_set_screen (context, gdk_screen_get_default ()); gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT); gtk_style_context_add_class (context, "gnome-panel-menu-bar"); gtk_style_context_add_class (context, "mate-panel-menu-bar"); gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg_color); ind_config->foreground_color = g_strdup_printf ("%g %g %g", fg_color.red, fg_color.green, fg_color.blue); g_object_unref (G_OBJECT (context)); gtk_widget_path_unref (widget_path); } ind_config->background_color = g_settings_get_string (ind_config->settings, MATEKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR); }
static gboolean remmina_icon_foreach_window(GtkWidget *widget, gpointer data) { GtkWidget *popup_menu = GTK_WIDGET(data); GtkWidget *menuitem; GdkScreen *screen; gint screen_number; if (G_TYPE_CHECK_INSTANCE_TYPE(widget, REMMINA_TYPE_CONNECTION_WINDOW)) { screen = gdk_screen_get_default(); screen_number = gdk_screen_get_number(screen); if (screen_number == gdk_screen_get_number(gtk_window_get_screen(GTK_WINDOW(widget)))) { menuitem = gtk_menu_item_new_with_label(gtk_window_get_title(GTK_WINDOW(widget))); gtk_widget_show(menuitem); gtk_menu_shell_prepend(GTK_MENU_SHELL(popup_menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_on_activate_window), widget); return TRUE; } } return FALSE; }
main (int argc, char *argv[]) { GOptionContext *context = NULL; GError *error = NULL; GdkScreen *screen; GdkRectangle rect; GnomeBG *bg; GSettings *settings; GdkPixbuf *pixbuf; gdk_init (&argc, &argv); context = g_option_context_new ("- refresh wallpaper cache"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_printerr ("option parsing failed: %s\n", error->message); g_option_context_free(context); g_error_free (error); return (1); } if (context) g_option_context_free (context); /* cache only the first monitor */ screen = gdk_screen_get_default (); gdk_screen_get_monitor_geometry (screen, 0, &rect); bg = gnome_bg_new (); settings = g_settings_new ("org.cinnamon.desktop.background"); gnome_bg_load_from_preferences (bg, settings); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, rect.width, rect.height); gnome_bg_draw (bg, pixbuf, screen, FALSE); g_object_unref (settings); return (0); }
gboolean update_n_monitor_info(gint index,struct DisplayInfo* info) { GdkScreen* screen = gdk_screen_get_default(); if (screen == NULL) { return FALSE; } gint len = gdk_screen_get_n_monitors(screen); if (index > len - 1) { return FALSE; } GdkRectangle dest; gdk_screen_get_monitor_geometry(screen, index, &dest); info->x = dest.x; info->y = dest.y; info->width = dest.width; info->height = dest.height; info->index = index; g_message("[%s] gdk monitors num: %d, index: %d, %d*%d(%d,%d)\n", __func__, len, info->index, info->width, info->height, info->x, info->y); return TRUE; }
/* panel_init */ static int _panel_init(Panel * panel, PanelWindowPosition position, PanelWindowType type, GtkIconSize iconsize) { const PanelPosition top = PANEL_POSITION_TOP; char * filename; GdkRectangle rect; size_t i; if((panel->config = config_new()) == NULL) return -1; if((filename = _config_get_filename()) != NULL && config_load(panel->config, filename) != 0) error_print(PROGNAME); free(filename); panel->prefs.iconsize = NULL; panel->prefs.monitor = -1; /* root window */ panel->screen = gdk_screen_get_default(); panel->root = gdk_screen_get_root_window(panel->screen); gdk_screen_get_monitor_geometry(panel->screen, 0, &rect); panel->root_height = rect.height; panel->root_width = rect.width; /* panel window */ _helper_init(&panel->helper[top], panel, type, iconsize); panel->windows[top] = panel_window_new(&panel->helper[top], PANEL_WINDOW_TYPE_NORMAL, position, iconsize, &rect); panel->helper[top].window = panel->windows[top]; for(i = 0; i < sizeof(panel->windows) / sizeof(*panel->windows); i++) if(i != top) panel->windows[i] = NULL; panel->source = 0; panel->timeout = 0; panel->ab_window = NULL; panel->lk_window = NULL; panel->lo_window = NULL; panel->sh_window = NULL; panel->su_window = NULL; return 0; }
static void maybe_lock_screen (void) { gboolean call_multiple_screensaver = FALSE; GError *error = NULL; char *command; GdkScreen *screen; screen = gdk_screen_get_default (); if (is_program_in_path ("gnome-screensaver-command") || is_program_in_path ("mate-screensaver-command")) { command = g_strdup ("gnome-screensaver-command --lock || mate-screensaver-command --lock"); call_multiple_screensaver = TRUE; } if (is_program_in_path ("gnome-screensaver-command")) { command = g_strdup ("gnome-screensaver-command --lock"); } else if (is_program_in_path ("mate-screensaver-command")) { command = g_strdup ("mate-screensaver-command --lock"); } else if (is_program_in_path ("xscreensaver-command")) { command = g_strdup ("xscreensaver-command -lock"); } else if( access( "/usr/lib/kde4/libexec/kscreenlocker_greet", X_OK ) != -1 ) { command = g_strdup ("/usr/lib/kde4/libexec/kscreenlocker_greet"); } else { return; } if (! gdk_spawn_command_line_on_screen (screen, command, &error)) { if (! call_multiple_screensaver) { g_warning ("Cannot lock screen: %s", error->message); } g_error_free (error); } g_free (command); }
GdkPixmap* create_pixmap (int width, int height) { GdkColormap* colormap; GdkDrawable* drawable; cairo_t * cr; colormap = gdk_screen_get_system_colormap (gdk_screen_get_default ()); g_assert (colormap); drawable = gdk_pixmap_new (NULL, 200, 200, gdk_colormap_get_visual (colormap)->depth); g_test_queue_unref (drawable); gdk_drawable_set_colormap (drawable, colormap); cr = gdk_cairo_create (drawable); cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_paint (cr); cairo_destroy (cr); return drawable; }
GList * gtksharp_get_gdk_net_supported (void) { GdkAtom actual_property_type; int actual_format; int actual_length; long *data = NULL; GList *list = NULL; int i; if (!gdk_property_get ( gdk_screen_get_root_window (gdk_screen_get_default ()), gdk_atom_intern ("_NET_SUPPORTED", FALSE), gdk_atom_intern ("ATOM", FALSE), 0, G_MAXLONG, FALSE, &actual_property_type, &actual_format, &actual_length, (guchar **) &data)) { gchar *actual_property_type_name; g_critical ("Unable to get _NET_SUPPORTED"); actual_property_type_name = gdk_atom_name (actual_property_type); if (actual_property_type_name) { g_message ("actual_property_type: %s", actual_property_type_name); g_free (actual_property_type_name); } return NULL; } /* Put all of the GdkAtoms into a GList to return */ for (i = 0; i < actual_length / sizeof (long); i ++) { list = g_list_append (list, (GdkAtom) data [i]); } g_free (data); return list; }
static void cairo_menu_init (CairoMenu *self) { CairoMenuPrivate * priv = GET_PRIVATE (self); priv->cairo_style = FALSE; if (priv->cairo_style) { static GdkScreen * screen = NULL; static GdkColormap * newmap = NULL; if (!screen) { screen = gdk_screen_get_default(); } if (!newmap) { newmap = gdk_screen_get_rgba_colormap (screen); } gtk_widget_set_colormap (GTK_WIDGET(self),newmap); awn_utils_ensure_transparent_bg (GTK_WIDGET(self)); } }
/* we adjust the scrollable-window size to contain the whole area */ static void on_settings_list_realize (GtkWidget * widget, gpointer user_data) { GtkWidget *parent = GTK_WIDGET (user_data); GtkRequisition requisition; gint height; gint max_height = gdk_screen_get_height (gdk_screen_get_default ()); gtk_widget_get_preferred_size (widget, NULL, &requisition); GST_LOG ("#### list size req %d x %d (max-height=%d)", requisition.width, requisition.height, max_height); height = requisition.height; // constrain the height by screen height if (height > max_height) { // lets hope that 32 gives enough space for window-decoration + panels height = max_height - 32; } // TODO(ensonic): is the '2' some border or padding gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), height + 4); }
/** * ephy_gui_help: * @parent: the parent window where help is being called * @page: help page to open or %NULL * * Displays Epiphany's help, opening the page indicated by @page. * * Note that @parent is used to know the #GdkScreen where to open the help * window. **/ void ephy_gui_help (GtkWidget *parent, const char *page) { GError *error = NULL; GdkScreen *screen; char *url; if (page) url = g_strdup_printf ("help:epiphany/%s", page); else url = g_strdup ("help:epiphany"); if (parent) screen = gtk_widget_get_screen (parent); else screen = gdk_screen_get_default (); gtk_show_uri (screen, url, gtk_get_current_event_time (), &error); if (error != NULL) { GtkWidget *dialog; dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not display help: %s"), error->message); g_error_free (error); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (dialog); } g_free (url); }
void themes_init (Gimp *gimp) { GimpGuiConfig *config; g_return_if_fail (GIMP_IS_GIMP (gimp)); config = GIMP_GUI_CONFIG (gimp->config); /* Check for theme extensions. */ themes_theme_paths_notify (gimp->extension_manager, NULL, gimp); g_signal_connect (gimp->extension_manager, "notify::theme-paths", G_CALLBACK (themes_theme_paths_notify), gimp); themes_style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); /* Use GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1 so theme files * override default styles provided by widgets themselves. */ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), themes_style_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1); g_object_unref (themes_style_provider); g_signal_connect (config, "notify::theme", G_CALLBACK (themes_theme_change_notify), gimp); g_signal_connect (config, "notify::prefer-dark-theme", G_CALLBACK (themes_theme_change_notify), gimp); g_signal_connect (config, "notify::prefer-symbolic-icons", G_CALLBACK (themes_theme_change_notify), gimp); themes_theme_change_notify (config, NULL, gimp); }
static GdkPixbuf * get_pixbuf_from_theme (const char *icon_name) { GdkScreen *screen; GtkIconTheme *theme; GdkPixbuf *pixbuf; GError *error; screen = gdk_screen_get_default (); theme = gtk_icon_theme_get_for_screen (screen); error = NULL; pixbuf = gtk_icon_theme_load_icon (theme, icon_name, PREFERED_WIDTH, PREFERED_HEIGHT, &error); if (pixbuf == NULL) { g_warning ("Failed to load icon %s: %s", icon_name, error->message); g_error_free (error); error = NULL; pixbuf = gtk_icon_theme_load_icon (theme, "image-missing", PREFERED_WIDTH, PREFERED_HEIGHT, &error); if (pixbuf == NULL) { g_critical ("Failed to load fallback icon: %s", error->message); g_error_free (error); } } return pixbuf; }
static GtkStyleProvider * add_extra_css (const char *testname, const char *extension) { GtkStyleProvider *provider = NULL; char *css_file; css_file = get_test_file (testname, extension, TRUE); if (css_file == NULL) return NULL; provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); gtk_css_provider_load_from_path (GTK_CSS_PROVIDER (provider), css_file, NULL); gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), provider, GTK_STYLE_PROVIDER_PRIORITY_FORCE); g_free (css_file); return provider; }
static void add_style_from_resource (const char *resource) { GtkCssProvider *provider; GFile *file; char *uri; provider = gtk_css_provider_new (); uri = g_strconcat ("resource://", resource, NULL); file = g_file_new_for_uri (uri); if (!gtk_css_provider_load_from_file (provider, file, NULL)) goto out; gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); out: g_object_unref (file); g_free (uri); }
void iupgtkPushVisualAndColormap(void* visual, void* colormap) { #if GTK_CHECK_VERSION(3, 0, 0) (void)visual; (void)colormap; #else GdkColormap* gdk_colormap; #if GTK_CHECK_VERSION(2, 24, 0) GdkScreen* screen = gdk_screen_get_default(); GdkVisual* gdk_visual = gdk_x11_screen_lookup_visual(screen, XVisualIDFromVisual((Visual*)visual)); #else GdkVisual* gdk_visual = gdkx_visual_get(XVisualIDFromVisual((Visual*)visual)); #endif if (colormap) gdk_colormap = gdk_x11_colormap_foreign_new(gdk_visual, (Colormap)colormap); else gdk_colormap = gdk_colormap_new(gdk_visual, FALSE); gtk_widget_push_colormap(gdk_colormap); /* gtk_widget_push_visual is now deprecated */ #endif }
static void ide_keybindings_unload_plugin (IdeKeybindings *self, PeasPluginInfo *plugin_info, PeasEngine *engine) { GtkStyleProvider *provider; const gchar *module_name; g_assert (IDE_IS_KEYBINDINGS (self)); g_assert (plugin_info != NULL); g_assert (PEAS_IS_ENGINE (engine)); if (self->plugin_providers == NULL) return; module_name = peas_plugin_info_get_module_name (plugin_info); provider = g_hash_table_lookup (self->plugin_providers, module_name); if (provider == NULL) return; gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (), provider); g_hash_table_remove (self->plugin_providers, module_name); }
static void nemo_main_application_open_location (NemoApplication *application, GFile *location, GFile *selection, const char *startup_id) { NemoWindow *window; GList *sel_list = NULL; window = nemo_main_application_create_window (application, gdk_screen_get_default ()); gtk_window_set_startup_id (GTK_WINDOW (window), startup_id); if (selection != NULL) { sel_list = g_list_prepend (sel_list, nemo_file_get (selection)); } nemo_window_slot_open_location_full (nemo_window_get_active_slot (window), location, 0, sel_list, NULL, NULL); if (sel_list != NULL) { nemo_file_list_free (sel_list); } }
void onRowActivated(GtkTreeView* treeview, GtkTreePath* path,GtkTreeViewColumn* col,gpointer userdata) { GtkTreeModel *model; GtkTreeIter iter; gchar *name; char *command; GdkModifierType mask; const char *app; #ifdef _USEGTK3_ GdkDeviceManager *device_manager=gdk_display_get_device_manager(gdk_display_get_default()); GdkDevice *device=gdk_device_manager_get_client_pointer(device_manager); GdkWindow *window; window=gdk_screen_get_active_window (gdk_screen_get_default()); gdk_window_get_device_position(window,device,NULL,NULL,&mask); #else gdk_window_get_pointer(NULL,NULL,NULL,&mask); #endif model=gtk_tree_view_get_model(treeview); if(gtk_tree_model_get_iter(model,&iter,path)) { gtk_tree_model_get(model,&iter,COLUMN_PATHNAME,&name,-1); app=getApp(name); asprintf(&command,"%s '%s'",app,name); if (GDK_CONTROL_MASK & mask ) runCommand(command,NULL,false,TOOL_ASYNC,true,NULL); else runCommand(command,NULL,false,TOOL_ASYNC,false,NULL); debugFree(&command); debugFree(&name); } }
Pixmap ShadowHelper::createPixmap( const Cairo::Surface& surface, int opacity ) const { assert( surface.isValid() ); int width(0); int height(0); cairo_surface_get_size( surface, width, height ); GdkScreen* screen = gdk_screen_get_default(); Display* display( GDK_DISPLAY_XDISPLAY( gdk_screen_get_display( screen ) ) ); Window root( GDK_WINDOW_XID( gdk_screen_get_root_window( screen ) ) ); Pixmap pixmap = XCreatePixmap( display, root, width, height, 32 ); // create surface for pixmap { Cairo::Surface dest( cairo_xlib_surface_create( display, pixmap, GDK_VISUAL_XVISUAL( gdk_screen_get_rgba_visual( screen ) ), width, height ) ); Cairo::Context context( dest ); cairo_set_operator( context, CAIRO_OPERATOR_SOURCE ); cairo_rectangle( context, 0, 0, width, height ); cairo_set_source_surface( context, surface, 0, 0 ); cairo_fill( context ); if( opacity < 255 ) { cairo_set_operator( context, CAIRO_OPERATOR_DEST_IN ); cairo_set_source( context, ColorUtils::Rgba( 0, 0, 0, double(opacity)/255 ) ); cairo_rectangle( context, 0, 0, width, height ); cairo_fill( context ); } } return pixmap; }
static void awn_tooltip_init (AwnTooltip *tooltip) { AwnTooltipPrivate *priv; GError *error = NULL; GdkScreen *screen; priv = tooltip->priv = AWN_TOOLTIP_GET_PRIVATE (tooltip); priv->client = awn_config_get_default (AWN_PANEL_ID_DEFAULT, &error); if (error) { g_critical ("An error occurred while trying to retrieve the configuration client: %s", error->message); g_error_free (error); return; } priv->text = NULL; priv->font_name = NULL; priv->font_color = NULL; priv->position = GTK_POS_BOTTOM; priv->size = 50; priv->show_timer_id = 0; priv->hide_timer_id = 0; gtk_widget_set_app_paintable (GTK_WIDGET (tooltip), TRUE); g_signal_connect (tooltip, "configure-event", G_CALLBACK (_on_configure_event), NULL); g_signal_connect (tooltip, "composited-changed", G_CALLBACK (_on_composited_changed), NULL); screen = gdk_screen_get_default (); if (gdk_screen_get_rgba_colormap (screen)) gtk_widget_set_colormap (GTK_WIDGET (tooltip), gdk_screen_get_rgba_colormap (screen)); }
/* * static applet config functions */ static void matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config) { ind_config->font_family = g_settings_get_string (ind_config->settings, MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY); if (ind_config->font_family == NULL || ind_config->font_family[0] == '\0') { PangoFontDescription *fd = NULL; GtkWidgetPath *widget_path = gtk_widget_path_new (); GtkStyleContext *context = gtk_style_context_new (); gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name (widget_path, -1 , "PanelWidget"); gtk_style_context_set_path (context, widget_path); gtk_style_context_set_screen (context, gdk_screen_get_default ()); gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT); gtk_style_context_add_class (context, "gnome-panel-menu-bar"); gtk_style_context_add_class (context, "mate-panel-menu-bar"); gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &fd, NULL); if (fd != NULL) { ind_config->font_family = g_strdup (pango_font_description_to_string(fd)); } g_object_unref (G_OBJECT (context)); gtk_widget_path_unref (widget_path); } xkl_debug (150, "font: [%s]\n", ind_config->font_family); }
static GList * create_secondary_break_windows (void) { GdkDisplay *display; GdkScreen *screen; GtkWidget *window; gint i; GList *windows = NULL; display = gdk_display_get_default (); for (i = 0; i < gdk_display_get_n_screens (display); i++) { screen = gdk_display_get_screen (display, i); if (screen == gdk_screen_get_default ()) { /* Handled by DrwBreakWindow. */ continue; } window = gtk_window_new (GTK_WINDOW_POPUP); windows = g_list_prepend (windows, window); gtk_window_set_screen (GTK_WINDOW (window), screen); gtk_window_set_default_size (GTK_WINDOW (window), gdk_screen_get_width (screen), gdk_screen_get_height (screen)); gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); drw_setup_background (GTK_WIDGET (window)); gtk_window_stick (GTK_WINDOW (window)); gtk_widget_show (window); } return windows; }
void moth_gui::init_video() { GdkScreen *gdk_screen = gdk_screen_get_default(); int error = SDL_Init(SDL_INIT_VIDEO); if (error != SUCCESS || NULL == gdk_screen) { std::cerr<< "Video initialization failed: " << SDL_GetError( ) << std::endl; throw moth_bad_gui(); } int monitor = gdk_screen_get_primary_monitor(gdk_screen); GdkRectangle res; gdk_screen_get_monitor_geometry(gdk_screen, monitor, &res); const SDL_VideoInfo *info = SDL_GetVideoInfo(); if (!info) { std::cerr<< "Get Video info failed: " << SDL_GetError( ) << std::endl; throw moth_bad_gui(); } bpp = info->vfmt->BitsPerPixel; width = res.width; height = res.height; flags = SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_OPENGL | SDL_RESIZABLE; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); screen = SDL_SetVideoMode(width, height, bpp, flags); if(NULL == screen) { std::cerr<< "Set Video Mode failed: " << SDL_GetError( ) << std::endl; throw moth_bad_gui(); } SDL_WM_SetCaption("moth - " MOTH_VER_STRING, NULL); init_opengl(); }
static void css_setup (struct desktop *desktop) { GtkCssProvider *provider; GFile *file; GError *error = NULL; provider = gtk_css_provider_new (); file = g_file_new_for_uri ("resource:///org/raspberry-pi/maynard/style.css"); if (!gtk_css_provider_load_from_file (provider, file, &error)) { g_warning ("Failed to load CSS file: %s", error->message); g_clear_error (&error); g_object_unref (file); return; } gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (provider), 600); g_object_unref (file); }
void SetPos(CefWindowHandle handle, int x, int y, int width, int height) { GtkWindow* window = GetWindow(handle); GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window)); // Make sure the window isn't minimized or maximized. if (IsMaximized(window)) gtk_window_unmaximize(window); else gtk_window_present(window); // Retrieve information about the display that contains the window. GdkScreen* screen = gdk_screen_get_default(); gint monitor = gdk_screen_get_monitor_at_window(screen, gdk_window); GdkRectangle rect; gdk_screen_get_monitor_geometry(screen, monitor, &rect); // Make sure the window is inside the display. CefRect display_rect(rect.x, rect.y, rect.width, rect.height); CefRect window_rect(x, y, width, height); ModifyBounds(display_rect, window_rect); gdk_window_move_resize(gdk_window, window_rect.x, window_rect.y, window_rect.width, window_rect.height); }
static GtkCssProvider * load_css_from_resource (const gchar *filename, gboolean required) { GError *error = NULL; GFile *css_file; GtkCssProvider *provider; gchar *resource_name; resource_name = g_strdup_printf ("resource:///org/gnome/gedit/css/%s", filename); css_file = g_file_new_for_uri (resource_name); g_free (resource_name); if (!required && !g_file_query_exists (css_file, NULL)) { g_object_unref (css_file); return NULL; } provider = gtk_css_provider_new (); if (gtk_css_provider_load_from_file (provider, css_file, &error)) { gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } else { g_warning ("Could not load css provider: %s", error->message); g_error_free (error); } g_object_unref (css_file); return provider; }
void gdk_property_delete (GdkWindow *window, GdkAtom property) { g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window)); if (!window) { GdkScreen *screen = gdk_screen_get_default (); window = gdk_screen_get_root_window (screen); GDK_NOTE (MULTIHEAD, g_message ("gdk_property_delete(): window is NULL\n")); } else if (!GDK_WINDOW_IS_X11 (window)) return; if (GDK_WINDOW_DESTROYED (window)) return; XDeleteProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XWINDOW (window), gdk_x11_atom_to_xatom_for_display (GDK_WINDOW_DISPLAY (window), property)); }
void mdm_wm_screen_init (int cur_screen_num) { GdkScreen *screen; int i; if (g_getenv ("FAKE_XINERAMA_MDM") != NULL) { /* for testing Xinerama support on non-xinerama setups */ mdm_wm_screen.x = 100; mdm_wm_screen.y = 100; mdm_wm_screen.width = gdk_screen_width () / 2 - 100; mdm_wm_screen.height = gdk_screen_height () / 2 - 100; mdm_wm_allscreens = g_new0 (GdkRectangle, 2); mdm_wm_allscreens[0] = mdm_wm_screen; mdm_wm_allscreens[1].x = gdk_screen_width () / 2; mdm_wm_allscreens[1].y = gdk_screen_height () / 2; mdm_wm_allscreens[1].width = gdk_screen_width () / 2; mdm_wm_allscreens[1].height = gdk_screen_height () / 2; mdm_wm_screens = 2; return; } screen = gdk_screen_get_default (); mdm_wm_screens = gdk_screen_get_n_monitors (screen); mdm_wm_allscreens = g_new (GdkRectangle, mdm_wm_screens); for (i = 0; i < mdm_wm_screens; i++) gdk_screen_get_monitor_geometry (screen, i, mdm_wm_allscreens + i); if (mdm_wm_screens < cur_screen_num) cur_screen_num = 0; mdm_wm_screen = mdm_wm_allscreens[cur_screen_num]; }
/************************************************************* Get display color type of default visual *************************************************************/ enum Display_color_type get_visual(void) { GdkVisual *visual; GdkVisualType type; visual = gdk_screen_get_system_visual(gdk_screen_get_default()); type = gdk_visual_get_visual_type(visual); if (type == GDK_VISUAL_STATIC_GRAY) { /* StaticGray, use black and white */ log_verbose("found B/W display."); return BW_DISPLAY; } if(type < GDK_VISUAL_STATIC_COLOR) { /* No color visual available at default depth */ log_verbose("found grayscale(?) display."); return GRAYSCALE_DISPLAY; } log_verbose("color system booted ok."); return COLOR_DISPLAY; }