Thread: [java-gnome-hackers] org.gnome.gdk.EventButton.getX()/getY(): double vs int
Brought to you by:
afcowie
From: Stefan P. <st...@pr...> - 2008-10-06 18:38:49
|
Hi all, I just stumbled upon the not yet exposed methods getX() and getY() in org.gnome.gdk.EventButton and Andrew's comment: * I'm not exposing these yet; why on earth are they double? If there's * no good reason or it's legacy crap, we're going to change the return * signature to int. I agree that I don't see a point in not having integers here. So, if noone is coming with a good example why to use doubles here, I suggest that we expose them as ints. Any comments? Stefan |
From: Stefan P. <st...@pr...> - 2008-10-06 20:38:15
|
Hi, Am Montag, den 06.10.2008, 15:33 -0400 schrieb Gerald Butler: > Is it possible to have fractional mouse locations reported under > various coordinate transformation matrixes? Perhaps when things like > "Multi-Touch" become wide-spread? What does the underlying GTK API > have to say about this? Nearly nothing. gdouble x; the x coordinate of the pointer relative to the window. is all I can find in the API docs for that type. Regarding transformation: The only way that I can imagine coordinate transformation leading to non-integer values is for example when a kind of magnifying glass follows the mouse cursor so that the screen pixels may not match application pixels. (Just a quick thought - might prove false when you think closer about it.) But even dropping the fractional part or rounding it seems ok. Plus: We avoid confusion for application developers. Cheers, Stefan |
From: Andrew C. <an...@op...> - 2008-10-07 02:48:13
|
On Mon, 2008-10-06 at 20:14 +0200, Stefan Prelle wrote: > I just stumbled upon the not yet exposed methods getX() and getY() ... > I agree that I don't see a point in not having integers here. Great. As it happens, I actually ran into needing these a few weeks ago and so went ahead and did this. See revision an...@op...-20080924020725-15qyh3lc7y8rwavh which was merged to 'mainline' at revno 565. AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management. We actively carry out research and development in these areas on behalf of our clients, and enable successful use of open source in their mission critical enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |
From: Owen T. <ot...@re...> - 2008-10-07 12:53:51
|
On Mon, 2008-10-06 at 20:14 +0200, Stefan Prelle wrote: > Hi all, > > I just stumbled upon the not yet exposed methods getX() and getY() > in org.gnome.gdk.EventButton and Andrew's comment: > > * I'm not exposing these yet; why on earth are they double? If there's > * no good reason or it's legacy crap, we're going to change the return > * signature to int. > > I agree that I don't see a point in not having integers here. So, if > noone is coming with a good example why to use doubles here, I suggest > that we expose them as ints. > > Any comments? They are double because in some cases sub-pixel positioning is available... for example, when tablet support is enabled. This is important for, among things, painting programs. Any questions? - Owen |
From: Srichand P. <sri...@gm...> - 2008-10-08 05:13:53
|
On Mon, Oct 6, 2008 at 2:14 PM, Stefan Prelle <st...@pr...> wrote: > Hi all, > Hi Stefan, I just stumbled upon the not yet exposed methods getX() and getY() > in org.gnome.gdk.EventButton and Andrew's comment: > > * I'm not exposing these yet; why on earth are they double? If there's > * no good reason or it's legacy crap, we're going to change the return > * signature to int. > > I agree that I don't see a point in not having integers here. So, if > noone is coming with a good example why to use doubles here, I suggest > that we expose them as ints. > > Any comments? > > Stefan > > There certainly are useful applications where doubles rather than ints would be useful. I've been working on some research on pen strokes on touchscreen surfaces, such as tablet PCs, external USB tablets (Wacom style stuff) and handheld devices. For a lot of the algorithms, subpixel accuracy is certainly useful. By constraining values to ints, you're losing (possibly) valuable bits of information. Instead of deciding which pixel to select (by truncating the numbers after the decimal), sometimes its useful to let the application/algorithm decide what it wants to do. Just my 2c. Srichand -- Srichand Pendyala http://srichand.net.in/ |
From: Andrew C. <an...@op...> - 2008-10-08 07:03:26
|
Informed participation, great! On Wed, 2008-10-08 at 01:13 -0400, Srichand Pendyala wrote: > There certainly are useful applications where doubles rather than ints > would be useful... The consensus is clearly to leave it as double. [Now that I think about it, doubles line up with Cairo space, so hey.] In any event, the bar to diverge from underlying API is high and clearly not being met (anymore) in this case. So I don't object. So which one of you who wants it double is going to fix it? :) Make sure you add some casts to the example at TreeView's getPathAtPos() as well. http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/TreeView.html#getPathAtPos(int,%20int) AfC Sydney |