Thanks for your answers. I did fool around with a popup, but it would also overlap other windows, transient or not. Furthermore, I need it to move relative to the window if that is moved.
Maybe it's best if I tell you what I'm trying to do in particular: I'm working on something like a tooltip. However, I don't think I can use normal tooltips, since I need to position it manually (actually, I need it to move out of the way if the mouse cursor approaches it). A popup sounds like the right way to do this, but I need to somehow wire the popup's movement to the window's movement. Is there an easy way to do that? On 07/13/2011 03:53 PM, Bill Czermak wrote: > Maybe the answer to your question is simply "No".... You are displaying > stuff in your window > > Generally the windows manager decides where on the screen to put stuff, > so you can either use your existing window and allow GTK to display > things as it thinks fit, which may not be what you expect. (Note the > comments about gtk_fixed in the documentation) or open a new top-level > window set transient to the main window, which sometimes positions > things where you expect. However the window manager decides where to > put the new window and with dual screens this can be interesting. > > Best approach might be to use a (possibly) modal dialog, which the user > can move out the way if he needs to. It this is not acceptable, then > your only choice is to display a complex widget on the main window, > maybe with a close button to destroy it if apprpriate > > Rgds Bill > > > > > > On 13/07/11 06:57, Sam Spilsbury wrote: >> 2011/7/13 Felix H. Dahlke<f...@ubercode.de>: >>> Hi, >>> >>> I'm fairly new to GTK (using version 2.24), and I'm wondering if I can >>> move a widget (partly) outside the area of a window and still have it >>> displayed. >>> >>> Consider the following code, where I've tried to use a GtkFixed to >>> position a label partly outside the window: >>> >>> ========== >>> int main(int argc, char* argv[]) >>> { >>> gtk_init(&argc,&argv); >>> >>> GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); >>> gtk_window_set_default_size(GTK_WINDOW(window), 320, 240); >>> gtk_container_border_width(GTK_CONTAINER(window), 10); >>> gtk_widget_show(window); >>> >>> GtkWidget* fixed = gtk_fixed_new(); >>> gtk_widget_set_has_window(fixed, TRUE); // Doesn't help >>> gtk_container_add(GTK_CONTAINER(window), fixed); >>> gtk_widget_show(fixed); >>> >>> GtkWidget* label = gtk_label_new("Hello World"); >>> // y = 238 should position the label partly outside the window >>> gtk_fixed_put((GtkFixed*) fixed, label, 0, 238); >>> gtk_widget_show(label); >>> >>> gtk_main(); >>> return 0; >>> } >>> ========== >>> >>> This is how I want it to look: >>> >>> ----------------------- >>> | | >>> | | >>> | | >>> | | >>> |-------------- | >>> -| |-------- >>> | | >>> -------------- >>> >>> And this is how it actually looks: >>> >>> ----------------------- >>> | | >>> | | >>> | | >>> |-------------- | >>> || | | >>> || | | >>> |-------------- | >>> ----------------------- >>> >>> As you can see from the comments, I already tried to use >>> gtk_widget_set_has_window(fixed, TRUE), but it didn't do the >>> trick. How can I do this? >>> >> I can't say I know Gtk+ in any high level of detail, but just using my >> basic knowledge of X11 here, I'd say that gtk_widget_set_has_window >> (fixed, TRUE); is probably only giving the widget a subwindow of the >> toplevel window of your application and not another toplevel window in >> and of itself >> >> If you wanted to have that part of your widget appearing outside of >> the client window you'd need to create a new GtkWindow which is >> override-redirect (I believe the way to do this is to specify >> GTK_WINDOW_POPUP on creation) and set the WM_TRANSIENT_FOR hint to be >> your client's application window. Then you can draw whatever you want >> there and it will be outside of (albeit on top of) the application. >> >>> _______________________________________________ >>> gtk-app-devel-list mailing list >>> gtk-app-devel-list@gnome.org >>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list >>> >> >> > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list