Hi,

Sorry, took some time, I was busy with some bug fixing...  I started
with the Home applet example and managed to whip up a small example
(attached) that shows a transparent pop-up window.

-Kimmo

/*
 gcc -Wall `pkg-config gtk+-2.0 --cflags --libs` rgba-window-example.c -o rgba-window-example
 */

#include <gtk/gtk.h>

static gboolean
handle_expose (GtkWidget *widget, GdkEventExpose *event)
{
  cairo_t *cr;

  /* Create cairo context */
  cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
  gdk_cairo_region (cr, event->region);
  cairo_clip (cr);

  /* Draw alpha background */
  cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
  cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
  cairo_paint (cr);

  /* Free context */
  cairo_destroy (cr);

  return FALSE;
}

int main ()
{
  GtkWidget *win, *label;
  GdkScreen *screen;

  gtk_init (NULL, NULL);

  win = gtk_window_new (GTK_WINDOW_POPUP);
  screen = gtk_widget_get_screen (win);
  gtk_widget_set_colormap (win, gdk_screen_get_rgba_colormap (screen));
  gtk_widget_set_app_paintable (win, TRUE);

  gtk_widget_realize (win);
  gdk_window_set_back_pixmap (win->window, NULL, FALSE);
  gtk_window_move (GTK_WINDOW (win), 300, 200);

  label = gtk_label_new ("This is an RGBA window");
  gtk_container_add (GTK_CONTAINER (win), label);

  gtk_widget_show_all (win);

  g_signal_connect (win, "expose-event", G_CALLBACK (handle_expose), win);
  gtk_main ();
  return 0;
}

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to