I'm still banging my head against a wall with this:

why without reparenting the popup undecorated window to the main app window
it becomes transparent but the app menu doesn't work (it starts to be drawn
but immediately disappears) and viceversa?

The final version of my function is this:

void create_image_details(GtkWidget *callerobj,app_data_t *myapp) {
    GdkScreen *screen;
    PangoLayout *textbuff;
    cairo_t *cr;
    gint offset, padding, txtwidth, txtheight;

    offset = 20;
    padding = 10;
    /* For the widget itself let's use a GtkWindow */
    if ((myapp->imgparamwin != NULL) & GTK_IS_WINDOW(myapp->imgparamwin))
draw_image_details(myapp->imgparamwin,NULL,myapp);
    else {
        myapp->imgparamwin = gtk_window_new(GTK_WINDOW_POPUP);
        gtk_window_set_decorated(GTK_WINDOW (myapp->imgparamwin),FALSE);
        gtk_widget_set_app_paintable(myapp->imgparamwin,TRUE);
        screen = gtk_widget_get_screen(myapp->imgparamwin);

gtk_widget_set_colormap(myapp->imgparamwin,gdk_screen_get_rgba_colormap(screen));
        gtk_window_set_transient_for(GTK_WINDOW
(myapp->imgparamwin),GTK_WINDOW (myapp->mainwin));
        gtk_window_set_destroy_with_parent(GTK_WINDOW
(myapp->imgparamwin),TRUE);
        gtk_widget_realize(myapp->imgparamwin);
        /* Get the Cairo context and the overall dimensions of the text to
be displayed */
        cr = gdk_cairo_create(GDK_DRAWABLE (myapp->imgparamwin->window));
        textbuff = pango_cairo_create_layout(cr);
        pango_layout_set_markup(textbuff,myapp->imgparam,-1);
        pango_layout_get_pixel_size(textbuff,&txtwidth,&txtheight);
        cairo_destroy(cr);
        g_object_unref(textbuff);
        /* Show the widget */
        gtk_widget_set_size_request(myapp->imgparamwin,txtwidth +
padding,txtheight + padding);
        gtk_window_set_resizable(GTK_WINDOW (myapp->imgparamwin),FALSE);
        gtk_window_set_accept_focus(GTK_WINDOW (myapp->imgparamwin),FALSE);
        /*
gdk_window_set_override_redirect(myapp->imgparamwin->window,TRUE);

gdk_window_reparent(myapp->imgparamwin->window,gtk_widget_get_window(GTK_WIDGET
(myapp->mainwin)),offset,offset); */
        gtk_window_move(GTK_WINDOW (myapp->imgparamwin),offset,offset);
        gtk_widget_show(myapp->imgparamwin);
        /* Actual drawing needs to take place when the widget is exposed */
        g_signal_connect_after(myapp->imgparamwin,"expose-event",
                G_CALLBACK (draw_image_details),myapp);
    }
}

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

Reply via email to