20788N/A@@ -68,6 +68,8 @@ test_greeter_login_window_SOURCES = \
20788N/A test_greeter_login_window_LDADD = \
20788N/A@@ -110,6 +112,8 @@ test_greeter_panel_SOURCES = \
20788N/A@@ -200,6 +204,8 @@ test_user_chooser_SOURCES = \
20788N/A@@ -264,6 +270,8 @@ gdm_simple_greeter_SOURCES = \
20788N/A@@ -281,6 +289,10 @@ gdm_simple_greeter_LDADD = \
20788N/A+ COMPONENT_NORTH_WEST = 1 << 0,
20788N/A+ COMPONENT_NORTH_EAST = 1 << 2,
20788N/A+ COMPONENT_SOUTH_EAST = 1 << 6,
20788N/A+ COMPONENT_SOUTH_WEST = 1 << 8,
20788N/A+bilinear_gradient (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ guchar *src_pixels = gdk_pixbuf_get_pixels (src);
20788N/A+ p1 = src_pixels + (src_y - 1) * src_rowstride + (src_x - 1) * n_channels;
20788N/A+ p3 = src_pixels + src_y * src_rowstride + (src_x - 1) * n_channels;
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ guchar *p = dest_pixels + dest_rowstride *i;
20788N/A+ for (k = 0; k < n_channels; k++)
20788N/A+ guint start = ((height - i) * p1[k] + (1 + i) * p3[k]) / (height + 1);
20788N/A+ guint end = ((height - i) * p2[k] + (1 + i) * p4[k]) / (height + 1);
20788N/A+ dv[k] = (((gint)end - (gint)start) << 16) / (width + 1);
20788N/A+ v[k] = (start << 16) + dv[k] + 0x8000;
20788N/A+ for (k = 0; k < n_channels; k++)
20788N/A+horizontal_gradient (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ guchar *src_pixels = gdk_pixbuf_get_pixels (src);
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ guchar *p = dest_pixels + dest_rowstride *i;
20788N/A+ guchar *p1 = src_pixels + (src_y + i) * src_rowstride + (src_x - 1) * n_channels;
20788N/A+ for (k = 0; k < n_channels; k++)
20788N/A+ dv[k] = (((gint)p2[k] - (gint)p1[k]) << 16) / (width + 1);
20788N/A+ v[k] = (p1[k] << 16) + dv[k] + 0x8000;
20788N/A+ for (k = 0; k < n_channels; k++)
20788N/A+vertical_gradient (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ guchar *src_pixels = gdk_pixbuf_get_pixels (src);
20788N/A+ guchar *top_pixels, *bottom_pixels;
20788N/A+ top_pixels = src_pixels + (src_y - 1) * src_rowstride + (src_x) * n_channels;
20788N/A+ bottom_pixels = top_pixels + src_rowstride;
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ guchar *p = dest_pixels + dest_rowstride *i;
20788N/A+ for (j = width * n_channels; j; j--)
20788N/A+ *(p++) = ((height - i) * *(p1++) + (1 + i) * *(p2++)) / (height + 1);
20788N/A+replicate_single (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guchar *pixels = (gdk_pixbuf_get_pixels (src) +
20788N/A+ src_y * gdk_pixbuf_get_rowstride (src) +
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ guchar *p = dest_pixels + dest_rowstride *i;
20788N/A+replicate_rows (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ memcpy (dest_pixels + dest_rowstride * i, pixels, n_channels * width);
20788N/A+replicate_cols (GdkPixbuf *src,
20788N/A+ guint n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ guint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
20788N/A+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
20788N/A+ dest_rowstride = gdk_pixbuf_get_rowstride (result);
20788N/A+ dest_pixels = gdk_pixbuf_get_pixels (result);
20788N/A+ guchar *p = dest_pixels + dest_rowstride * i;
20788N/A+ guchar *q = pixels + src_rowstride * i;
20788N/A+/* Scale the rectangle (src_x, src_y, src_width, src_height)
20788N/A+ * onto the rectangle (dest_x, dest_y, dest_width, dest_height)
20788N/A+ * of the destination, and render into a pixbuf
20788N/A+ gboolean has_alpha = gdk_pixbuf_get_has_alpha (src);
20788N/A+ gint src_rowstride = gdk_pixbuf_get_rowstride (src);
20788N/A+ gint src_n_channels = gdk_pixbuf_get_n_channels (src);
20788N/A+ if (dest_width <= 0 || dest_height <= 0)
20788N/A+ if (dest_width == src_width && dest_height == src_height)
20788N/A+ tmp_pixbuf = g_object_ref (src);
20788N/A+ else if (src_width == 0 && src_height == 0)
20788N/A+ tmp_pixbuf = bilinear_gradient (src, src_x, src_y, dest_width, dest_height);
20788N/A+ else if (src_width == 0 && dest_height == src_height)
20788N/A+ tmp_pixbuf = horizontal_gradient (src, src_x, src_y, dest_width, dest_height);
20788N/A+ else if (src_height == 0 && dest_width == src_width)
20788N/A+ tmp_pixbuf = vertical_gradient (src, src_x, src_y, dest_width, dest_height);
20788N/A+ else if ((hints & THEME_CONSTANT_COLS) && (hints & THEME_CONSTANT_ROWS))
20788N/A+ tmp_pixbuf = replicate_single (src, src_x, src_y, dest_width, dest_height);
20788N/A+ else if (dest_width == src_width && (hints & THEME_CONSTANT_COLS))
20788N/A+ tmp_pixbuf = replicate_rows (src, src_x, src_y, dest_width, dest_height);
20788N/A+ else if (dest_height == src_height && (hints & THEME_CONSTANT_ROWS))
20788N/A+ tmp_pixbuf = replicate_cols (src, src_x, src_y, dest_width, dest_height);
20788N/A+ double x_scale = (double)dest_width / src_width;
20788N/A+ double y_scale = (double)dest_height / src_height;
20788N/A+ pixels = (gdk_pixbuf_get_pixels (src)
20788N/A+ partial_src = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB,
20788N/A+ tmp_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
20788N/A+ gdk_pixbuf_scale (partial_src, tmp_pixbuf,
20788N/A+ gdk_pixbuf_unref (partial_src);
20788N/A+ gdk_pixbuf_copy_area (tmp_pixbuf,
20788N/A+ gdk_pixbuf_unref (tmp_pixbuf);
20788N/A+compute_hint (GdkPixbuf *pixbuf,
20788N/A+ int hints = THEME_CONSTANT_ROWS | THEME_CONSTANT_COLS | THEME_MISSING;
20788N/A+ int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
20788N/A+ guchar *data = gdk_pixbuf_get_pixels (pixbuf);
20788N/A+ int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
20788N/A+ guchar *p = data + i * rowstride + x0 * n_channels;
20788N/A+ if (n_channels != 4 || p[3] != 0)
20788N/A+ if (!(hints & THEME_CONSTANT_ROWS))
20788N/A+ (n_channels != 4 && a != *(p++)))
20788N/A+ hints &= ~THEME_CONSTANT_ROWS;
20788N/A+ guchar *base = data + y0 * rowstride + x0 * n_channels;
20788N/A+ guchar *p = data + i * rowstride + x0 * n_channels;
20788N/A+ if (memcmp (p, base, n_channels * (x1 - x0)) != 0)
20788N/A+ hints &= ~THEME_CONSTANT_COLS;
20788N/A+constraint_scale_compute_hints (ConstraintScale *cs_pb)
20788N/A+ gint width = gdk_pixbuf_get_width (cs_pb->pixbuf);
20788N/A+ gint height = gdk_pixbuf_get_height (cs_pb->pixbuf);
20788N/A+ if (cs_pb->border_left + cs_pb->border_right > width ||
20788N/A+ cs_pb->border_top + cs_pb->border_bottom > height)
20788N/A+ g_warning ("Invalid borders specified");
20788N/A+ if (cs_pb->border_left + cs_pb->border_right > width)
20788N/A+ cs_pb->border_left = width / 2;
20788N/A+ cs_pb->border_right = (width + 1) / 2;
20788N/A+ if (cs_pb->border_bottom + cs_pb->border_top > height)
20788N/A+ cs_pb->border_top = height / 2;
20788N/A+ cs_pb->border_bottom = (height + 1) / 2;
20788N/A+ y1 = height - cs_pb->border_bottom;
20788N/A+ y0 = height - cs_pb->border_bottom;
20788N/A+ x1 = width - cs_pb->border_right;
20788N/A+ x0 = width - cs_pb->border_right;
20788N/A+ cs_pb->hints[i][j] = compute_hint (cs_pb->pixbuf, x0, x1, y0, y1);
20788N/A+constraint_scale (GdkPixbuf *pixbuf,
20788N/A+ gint src_x[4], src_y[4], dest_x[4], dest_y[4];
20788N/A+ gint pixbuf_width = gdk_pixbuf_get_width (pixbuf);
20788N/A+ gint pixbuf_height = gdk_pixbuf_get_height (pixbuf);
20788N/A+ ConstraintScale *cs_pb = g_new0 (ConstraintScale, 1);
20788N/A+ guint component_mask = COMPONENT_ALL;
20788N/A+ cs_pb->border_left = border_left;
20788N/A+ cs_pb->border_right = border_right;
20788N/A+ cs_pb->border_bottom = border_bottom;
20788N/A+ cs_pb->border_top = border_top;
20788N/A+ constraint_scale_compute_hints (cs_pb);
20788N/A+ scaled = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (cs_pb->pixbuf),
20788N/A+ gdk_pixbuf_get_has_alpha (cs_pb->pixbuf),
20788N/A+ gdk_pixbuf_get_bits_per_sample (cs_pb->pixbuf),
20788N/A+ gdk_pixbuf_fill (scaled, 0x00000000);
20788N/A+ src_x[1] = cs_pb->border_left;
20788N/A+ src_x[2] = pixbuf_width - cs_pb->border_right;
20788N/A+ src_y[2] = pixbuf_height - cs_pb->border_bottom;
20788N/A+ dest_x[1] = cs_pb->border_left;
20788N/A+ dest_x[2] = width - cs_pb->border_right;
20788N/A+ dest_y[1] = cs_pb->border_top;
20788N/A+ dest_y[2] = height - cs_pb->border_bottom;
20788N/A+ if (component_mask & COMPONENT_ALL)
20788N/A+ component_mask = (COMPONENT_ALL - 1) & ~component_mask;
20788N/A+#define RENDER_COMPONENT(X1,X2,Y1,Y2) \
20788N/A+ cs_render (pixbuf, cs_pb->hints[Y1][X1], \
20788N/A+ src_x[X2] - src_x[X1], src_y[Y2] - src_y[Y1], \
20788N/A+ dest_x[X2] - dest_x[X1], dest_y[Y2] - dest_y[Y1]);
20788N/A+ if (component_mask & COMPONENT_NORTH_WEST)
20788N/A+ RENDER_COMPONENT (0, 1, 0, 1);
20788N/A+ if (component_mask & COMPONENT_NORTH)
20788N/A+ RENDER_COMPONENT (1, 2, 0, 1);
20788N/A+ if (component_mask & COMPONENT_NORTH_EAST)
20788N/A+ RENDER_COMPONENT (2, 3, 0, 1);
20788N/A+ if (component_mask & COMPONENT_WEST)
20788N/A+ RENDER_COMPONENT (0, 1, 1, 2);
20788N/A+ if (component_mask & COMPONENT_CENTER)
20788N/A+ RENDER_COMPONENT (1, 2, 1, 2);
20788N/A+ if (component_mask & COMPONENT_EAST)
20788N/A+ RENDER_COMPONENT (2, 3, 1, 2);
20788N/A+ if (component_mask & COMPONENT_SOUTH_WEST)
20788N/A+ RENDER_COMPONENT (0, 1, 2, 3);
20788N/A+ if (component_mask & COMPONENT_SOUTH)
20788N/A+ RENDER_COMPONENT (1, 2, 2, 3);
20788N/A+ if (component_mask & COMPONENT_SOUTH_EAST)
20788N/A+ RENDER_COMPONENT (2, 3, 2, 3);
20788N/A+void set_pseudo_transparent_bg (GtkWidget *window,
20788N/A+ gboolean found_rootpmap = FALSE;
20788N/A+ root = gdk_screen_get_root_window (gdk_drawable_get_screen (GDK_DRAWABLE(window->window)));
20788N/A+ dpy = gdk_drawable_get_display(GDK_DRAWABLE(root));
20788N/A+ pmap_id = gdk_x11_xatom_to_atom_for_display (dpy, gdk_x11_get_xatom_by_name_for_display(dpy,
20788N/A+ while (!found_rootpmap && count <= 10000) /* wait until the prop is set, quick fix, better solution is to monitor */
20788N/A+ gdk_property_get(root, pmap_id, GDK_TARGET_PIXMAP,
20788N/A+ if ((prop_type == GDK_TARGET_PIXMAP) &&
20788N/A+ (prop_size >= (int)sizeof(XID) &&
20788N/A+ pixmap = gdk_pixmap_foreign_new_for_display(dpy, pixmaps[0]);
20788N/A+ /* Tell GTK+ that this foreign pixmap shares the
20788N/A+ rcolormap = gdk_drawable_get_colormap(root);
20788N/A+ if (gdk_drawable_get_colormap(pixmap) == NULL)
20788N/A+ gdk_drawable_set_colormap(pixmap,
20788N/A+ /* Retrieve the pixmap's size. */
20788N/A+ gdk_drawable_get_size(pixmap, &width, &height);
20788N/A+ gdk_display_sync(gdk_drawable_get_display(GDK_DRAWABLE(root)));
20788N/A+ /* If the pixmap gave us a valid size, retrieve its
20788N/A+ if ((width > 0) && (height > 0)) {
20788N/A+ bkg = gdk_pixbuf_get_from_drawable(NULL,
20788N/A+ gdk_display_sync(gdk_drawable_get_display(GDK_DRAWABLE(root)));
20788N/A+ gdk_window_get_origin (window->window, &new_x, &new_y);
20788N/A+ if (new_x == x && new_y == y) /* no change needed */
20788N/A+ /* position pixbuf according to window pos */
20788N/A+ gdk_window_get_geometry (window->window, NULL, NULL, &width, &height, NULL);
20788N/A+ if (y > gdk_pixbuf_get_height (bkg) - height)
20788N/A+ y = gdk_pixbuf_get_height (bkg) - height;
20788N/A+ /*return; *//* panel popping up */
20788N/A+ tmp_bkg = gdk_pixbuf_copy (bkg);
20788N/A+ app_bkg = gdk_pixbuf_new_subpixbuf (tmp_bkg, x,y,width, height);
20788N/A+ scaled = constraint_scale (overlay,
20788N/A+ border_left, border_right, border_top, border_bottom);
20788N/A+ gdk_pixbuf_render_pixmap_and_mask_for_colormap(app_bkg,
20788N/A+ gtk_widget_get_colormap (window),
20788N/A+ style = gtk_style_copy (window->style);
20788N/A+ if (style->bg_pixmap[GTK_STATE_NORMAL])
20788N/A+ g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
20788N/A+ style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (bg_pixmap);
20788N/A+ gtk_widget_set_style (window, style);
20788N/A+void set_pseudo_transparent_bg (GtkWidget *window,
20788N/A #define PW_ENTRY_SIZE GDM_MAX_PASS
20788N/A@@ -1699,6 +1701,7 @@ static const char *known_etc_info_files
20788N/A@@ -1850,6 +1853,7 @@ load_theme (GdmGreeterLoginWindow *login
20788N/A@@ -1878,10 +1882,9 @@ load_theme (GdmGreeterLoginWindow *login
20788N/A g_debug ("GdmGreeterLoginWindow: Got greeter logo '%s'",
20788N/A icon_name ? icon_name : "(null)");
20788N/A- gtk_image_set_from_icon_name (GTK_IMAGE (image),
20788N/A+ gtk_image_set_from_file (GTK_IMAGE (image),
20788N/A@@ -2093,6 +2096,33 @@ update_banner_message (GdmGreeterLoginWi
20788N/A+configure_function (GtkWidget *widget,
20788N/A+ set_pseudo_transparent_bg (widget, get_overlay_pb (), 5, 5,60 ,60);
20788N/A+map_function (GtkWidget *widget,
20788N/A+ set_pseudo_transparent_bg (widget, get_overlay_pb (), 5, 5,60 ,60);
20788N/A gdm_greeter_login_window_constructor (GType type,
20788N/A@@ -2106,10 +2136,17 @@ gdm_greeter_login_window_constructor (GT
20788N/A+ g_signal_connect (login_window, "map", G_CALLBACK (map_function), login_window);
20788N/A+ g_signal_connect (login_window, "configure_event", G_CALLBACK (configure_function), login_window);
20788N/A update_banner_message (login_window);
20788N/A+ gtk_frame_set_shadow_type(GTK_FRAME (gtk_builder_get_object (login_window->priv->builder, "window-frame")), GTK_SHADOW_NONE);
20788N/A+ gtk_widget_realize (GTK_WIDGET (login_window));
20788N/A+ gdk_window_set_back_pixmap (GTK_WIDGET (login_window)->window, NULL, FALSE);
20788N/A return G_OBJECT (login_window);
20788N/A #define GDM_GREETER_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_PANEL, GdmGreeterPanelPrivate))
20788N/A@@ -968,6 +970,32 @@ add_battery_menu (GdmGreeterPanel *panel
20788N/A panel->priv->power_menubar_item = item;
20788N/A+configure_function (GtkWidget *widget,
20788N/A+ set_pseudo_transparent_bg (widget, get_overlay_pb (), 0, 0, 5, 0);
20788N/A+map_function (GtkWidget *widget,
20788N/A+ set_pseudo_transparent_bg (widget, get_overlay_pb (), 0, 0, 5, 0);
20788N/A setup_panel (GdmGreeterPanel *panel)
20788N/A@@ -1045,6 +1073,9 @@ setup_panel (GdmGreeterPanel *panel)
20788N/A+ g_signal_connect (panel, "map", G_CALLBACK (map_function), panel);
20788N/A+ g_signal_connect (panel, "configure_event", G_CALLBACK (configure_function), panel);