Re: Can anyone tell me how to make a floating window?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jack Chen wrote:
   I did what you said yesterday, and got what I wanted with
gtk_window_set_transient_for(). But I don't know what
gtk_window_set_type_hint() is for. I checked the gtk reference manual
and it didn't say what the "hint", which is one of the parameters I
need to pass, was. Do you mind telling me how to use this function?

It's documented here:


http://developer.gnome.org/doc/API/2.0/gdk/gdk-Windows.html#GdkWindowTypeHint

that, but there's a new problem. I set the initial floating window's
position with gtk_window_move(), and set it to be unresizable. And when
I dragged the left edge to expand it the "whole window" moved to the
right, and when it moved to the right its left edge wasn't even under
my mouse. Is it a bug in gtk?

I wouldn't set the position explicitly. It's much better to use something like gtk_window_set_position(GTK_WIN_POS_CENTER_ON_PARENT) to hint what sort of position you would like, and leave it to the user's desktop to set the exact position for you. I'm not sure what's happening with the resizing thing.


There's a note explaining the issues here:

http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-get-size

Also I've noticed that just like with Gimp, whenever I drag a child
window across its parent the parent never updates itself, unless I let
go the left button of my mouse, but that way it looks pretty ugly
because I can erase my whole parent window by dragging the child window
around. Do you know the solution for this? I tried to add an idle
function to make the parent update itself constantly, but it's no use.

I think that only happens on windows, and I think it's been fixed in newer gtks (but the gtkwin list would be a better place to ask).


Also, do you know a way to create a window that has a border, and a
title bar with no icon and no max/min/close buttons, and it's actually
draggable by using its title bar? That is what I want to create for my
application.

Just experiment with different combinations of WindowTypeHint and _set_decorated(). Because gtk is a cross-platform toolkit, you're unlikely to find a combination which will give exactly what you want in all environments: all you can do is set the hints correctly and hope the users' window manager will do the right thing (most will).


John
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux