* getting the size and origin of a GtkWindow
@ 2001-01-29 13:07 Russell McManus
2001-01-29 15:36 ` Marius Vollmer
0 siblings, 1 reply; 5+ messages in thread
From: Russell McManus @ 2001-01-29 13:07 UTC (permalink / raw)
To: guile-gtk
I'd like to get and set the origin and size of a GtkWindow, that I've
created in guile-gtk. Is this possible?
Lots of sniffing around using (ice-9 session), apropos, etc., and
source code browsing leads me to believe that this functionality is
not currently accessible from guile-gtk. Just wanted to check.
I would consider adding this functionality and sending a patch if it's
missing. After spending a short while with the source, it's not clear
just how this would be done, aside from hacking up an interface by
hand.
-russ
--
"I, too, prefer to write general code first and get the shape and
functionality right, and then to tune as needed where a problem is
discovered."
-- Kent Pitman on comp.lang.lisp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting the size and origin of a GtkWindow
2001-01-29 13:07 getting the size and origin of a GtkWindow Russell McManus
@ 2001-01-29 15:36 ` Marius Vollmer
2001-01-29 17:50 ` Russell McManus
0 siblings, 1 reply; 5+ messages in thread
From: Marius Vollmer @ 2001-01-29 15:36 UTC (permalink / raw)
To: Russell McManus; +Cc: guile-gtk
Russell McManus <russell.mcmanus@msdw.com> writes:
> I'd like to get and set the origin and size of a GtkWindow, that I've
> created in guile-gtk. Is this possible?
Hmm, I don't think so. How would you do this from C? It is probably
easy to add the missing things to guile-gtk once it is clear in what
way the Gtk+ API wants to be used.
Hmm^2, the right way probably involves GtkAllocation which doesn't
exist in guile-gtk yet. I don't think we want to add support for it
because it is too similar to a rectangle.
Hmm^3, [time passes] I just added a `cname' field option to
build-guile-gtk. You can now say things like
(define-object GtkWidget (GtkObject)
(fields
(uint requisition-width (cname requisition.height))
(uint requisition-height (cname requisition.width))
(int allocation-x (cname allocation.x))
(int allocation-y (cname allocation.y))
(uint allocation-width (cname allocation.width))
(uint allocation-height (cname allocation.height))
(GtkStyle style)
(GdkWindow window)))
in the defs files and access the allocation.x field of a GtkWidget w
like so
(gtk-widget-allocation-x w)
Nice and esay, eh? :)
Please update from CVS to get this change. But I guess this is not
really what you want to have, right?
[ Maybe we should automatically translate dashes to dots in field
names. Dashes are illegal in C identifiers anyway... ]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting the size and origin of a GtkWindow
2001-01-29 15:36 ` Marius Vollmer
@ 2001-01-29 17:50 ` Russell McManus
2001-02-04 10:12 ` Marius Vollmer
0 siblings, 1 reply; 5+ messages in thread
From: Russell McManus @ 2001-01-29 17:50 UTC (permalink / raw)
To: Marius Vollmer; +Cc: guile-gtk
Marius Vollmer <mvo@zagadka.ping.de> writes:
> Russell McManus <russell.mcmanus@msdw.com> writes:
>
> > I'd like to get and set the origin and size of a GtkWindow, that I've
> > created in guile-gtk. Is this possible?
>
> Hmm, I don't think so. How would you do this from C? It is probably
> easy to add the missing things to guile-gtk once it is clear in what
> way the Gtk+ API wants to be used.
I won't respond to the totality of your message, because I haven't
tried your change (thanks for that, btw), but I will forward you this
email message that I found on the web:
How to get GtkWindow's position and size?
From: Carlos Pereira <carlos pehoe civil ist utl pt>
To: gtk-app-devel-list redhat com
Subject: How to get GtkWindow's position and size?
Date: Wed, 15 Mar 2000 14:32:28 GMT
>How to get GtkWindow's position and size?
You can use, for example:
gdk_window_get_origin (window->window, &x, &y);
gdk_window_get_size (window->window, &w, &h);
and then:
gdk_window_move_resize (window->window, x, y, w, h);
gdk_window_move (window->window, x, y);
gdk_window_resize (window->window, w, h);
-russ
--
The whole aim of practical politics is to keep the populace alarmed
[and hence clamorous to be led to safety] by menacing it with an
endless series of hobgoblins, all of them imaginary.
-- H.L. Mencken
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting the size and origin of a GtkWindow
2001-01-29 17:50 ` Russell McManus
@ 2001-02-04 10:12 ` Marius Vollmer
2001-02-05 4:55 ` Russell McManus
0 siblings, 1 reply; 5+ messages in thread
From: Marius Vollmer @ 2001-02-04 10:12 UTC (permalink / raw)
To: Russell McManus; +Cc: guile-gtk
Russell McManus <russell.mcmanus@msdw.com> writes:
> How to get GtkWindow's position and size?
> From: Carlos Pereira <carlos pehoe civil ist utl pt>
> To: gtk-app-devel-list redhat com
> Subject: How to get GtkWindow's position and size?
>
> >How to get GtkWindow's position and size?
>
> You can use, for example:
>
> gdk_window_get_origin (window->window, &x, &y);
> gdk_window_get_size (window->window, &w, &h);
Ahh, I see. gdk-window-get-size is already there, but
gdk-window-get-origin needs to be added (which I have done in CVS).
You can use them like this:
(define w (gtk-window-new 'toplevel))
...
(gdk-window-get-size (gtk-widget-window w))
=> (200 . 200)
As you can see, the functions return the two coordinates as a cons of
two numbers.
Does this help?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting the size and origin of a GtkWindow
2001-02-04 10:12 ` Marius Vollmer
@ 2001-02-05 4:55 ` Russell McManus
0 siblings, 0 replies; 5+ messages in thread
From: Russell McManus @ 2001-02-05 4:55 UTC (permalink / raw)
To: Marius Vollmer; +Cc: guile-gtk, Russell McManus
Marius Vollmer <mvo@zagadka.ping.de> writes:
> Ahh, I see. gdk-window-get-size is already there, but
> gdk-window-get-origin needs to be added (which I have done in CVS).
> You can use them like this:
>
> (define w (gtk-window-new 'toplevel))
> ...
> (gdk-window-get-size (gtk-widget-window w))
> => (200 . 200)
>
> As you can see, the functions return the two coordinates as a cons of
> two numbers.
>
> Does this help?
You betcha. Now I just have to figure out how to get anon CVS access
out through my firewall at work (I can 'runsocks ssh' anywhere on the
net, so I think it is possible). Thanks for looking at this.
-russ
--
A computer lets you make more mistakes faster than any invention in
human history with the possible exceptions of handguns and tequila.
-- Mitch Ratliffe, Technology Review, April, 1992
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-02-05 4:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-29 13:07 getting the size and origin of a GtkWindow Russell McManus
2001-01-29 15:36 ` Marius Vollmer
2001-01-29 17:50 ` Russell McManus
2001-02-04 10:12 ` Marius Vollmer
2001-02-05 4:55 ` Russell McManus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).