Axel Simon | 1 Oct 2007 16:03
Picon
Favicon

Re: Styles (was: A newbie need help)

Dear Deng,

I tried your example and sure enough it doesn't work as expected. I  
tried to understand the (really bad) documentation and came up with  
the following:

>     windowXml <- xmlNew "myStyle.glade"
>     let window = case windowXml of
>         (Just window) -> window
>         Nothing       -> error "Can't read glade file!"
>
>     winMain  <- xmlGetWidget window castToWindow "winMain"
>     btnStyle <- xmlGetWidget window castToButton "btnStyle"
>
>     widgetSetName winMain "winMain"
>     widgetSetName btnStyle "btnStyle"
>

a) You've already named you widgets in the .glade file, so you don't  
need to use the functions widgetSetName.

> then this is my .gtkrc-2.0 file:
> style "mySize" {
>     GtkButton::default_outside_border = { 10, 10, 10, 10 }
> }
> widget "btnStyle" style "mySize"

The property "default_outside_border" only works if the button has  
the "CAN_DEFAULT" flag set. AFAIK this means the button must be the  
default button of a dialog box. I think you can set this flag using  
(Continue reading)

Wolf Pfannenstiel | 3 Oct 2007 21:28
Picon

List length of ListStore

Hello GTK2HS experts,

I am using Graphics.UI.Gtk.ModelView.ListStore to store and display a
list of records. Using listStoreGetValue I can retrieve an entry of the
list at a given index. Now, I want to iterate over the model, e.g. to
write each list entry into a file. How do I determine the length or the
end of the list? I did not find any function(s) for this. What is the
way to go?

If you need more information please let me know.

Thanks in advance and best regards,
Wolf

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Peter Hercek | 4 Oct 2007 12:59
Favicon

gtk2hs patch for building in cygwin

Hi,

I tried to build gtk2hs in cygwin environment (with mingw compiler)
  and run into some issues. Most  were related to mingw not liking
  some spurious \r characters; there was also problem with too long
  command line for ar. The patch is at the end of this email.
I needed also to run this after make and before install since the
  package conf files contained something like ld-options: "\r"
  and ghc linker freaked out. This should be fixed somewhere else
  but I could not find it quickly (I do not know how package.conf
  files are generated).

for pkCf in `find -name .hg -prune -o -iname "*.package.conf" -print` ; do
   echo "Fixing possibly wrong ld-options in $pkCf"
   sed 's/"\r"//' $pkCf > pakcage.conf.temp.file
   mv pakcage.conf.temp.file $pkCf
done

My environment:
  * standard cygwin install with binary mount (but textmode mount
    does not fix the problems)
  * gcc 3.4.2 (mingw-special) (not the one in cygwin distribution)
  * winxp 64bit (but ghc, gtk, cygwin ... all 32 bit apps)
  * gtk2hs-0.9.12.tar.gz from sourceforge
  * gtk-dev-2.10.11-win32-1
  * ghc-6.6.1-i386-windows

I hope this helps somebody who tries to do the same,
Peter.

(Continue reading)

Peter Hercek | 4 Oct 2007 13:42
Favicon

mouse button patch (for buttons 4,5,6,7)

Hi,

A lot of mice has more than 3 buttons now (except the scrolling "buttons").
This makes btk2hs not to crash when mouse buttons 4, 5, 6, or 7 are pressed
while your gtk2hs app has focus. This was a problem on windows. I do not know
about linux or other versions.

Peter.

diff -r a035df086432 -r 2542890cac89 gtk/Graphics/UI/Gtk/General/Enums.chs.pp
--- a/gtk/Graphics/UI/Gtk/General/Enums.chs.pp  Thu Oct 04 10:42:08 2007 +0100
+++ b/gtk/Graphics/UI/Gtk/General/Enums.chs.pp  Thu Oct 04 11:11:08 2007 +0100
 <at>  <at>  -106,15 +106,27  <at>  <at>  data MouseButton = LeftButton
  data MouseButton = LeftButton
                  | MiddleButton
                  | RightButton
+                | MouseButton4
+                | MouseButton5
+                | MouseButton6
+                | MouseButton7
                    deriving (Eq,Show)

  instance Enum MouseButton where
    toEnum 1 = LeftButton
    toEnum 2 = MiddleButton
    toEnum 3 = RightButton
+  toEnum 4 = MouseButton4
+  toEnum 5 = MouseButton5
+  toEnum 6 = MouseButton6
+  toEnum 7 = MouseButton7
(Continue reading)

Axel Simon | 4 Oct 2007 15:42
Picon
Favicon

Re: mouse button patch (for buttons 4,5,6,7)

Peter,

On Thu, 2007-10-04 at 13:42 +0200, Peter Hercek wrote:
> Hi,
> 
> A lot of mice has more than 3 buttons now (except the scrolling "buttons").
> This makes btk2hs not to crash when mouse buttons 4, 5, 6, or 7 are pressed
> while your gtk2hs app has focus. This was a problem on windows. I do not know
> about linux or other versions.

I'm happy to apply this patch, but I just want to clarify something:

X Windows only deals with up to five button and buttons four and five
are the wheel and therefore don't show up as mouse presses. So my
question is: Does Win32 report those mouse presses with MouseButton4 for
some buttons on the side of the mouse, or is it for the wheel. I think
there's something wrong, if you get MouseButton4 and MouseButton5 for
the wheel. Can you confirm that this is not the case?

Thanks,
Axel.

> Peter.
> 
> 
> diff -r a035df086432 -r 2542890cac89 gtk/Graphics/UI/Gtk/General/Enums.chs.pp
> --- a/gtk/Graphics/UI/Gtk/General/Enums.chs.pp  Thu Oct 04 10:42:08 2007 +0100
> +++ b/gtk/Graphics/UI/Gtk/General/Enums.chs.pp  Thu Oct 04 11:11:08 2007 +0100
>  <at>  <at>  -106,15 +106,27  <at>  <at>  data MouseButton = LeftButton
>   data MouseButton = LeftButton
(Continue reading)

kahl | 4 Oct 2007 15:44
Picon
Picon
Favicon

Re: mouse button patch (for buttons 4,5,6,7)

 > 
 > X Windows only deals with up to five button and buttons four and five
 > are the wheel and therefore don't show up as mouse presses.

But that is only because of

        Option          "ZAxisMapping"          "4 5"

in xorg.conf?

Wolfram

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Axel Simon | 4 Oct 2007 15:50
Picon
Favicon

Re: List length of ListStore

On Wed, 2007-10-03 at 21:28 +0200, Wolf Pfannenstiel wrote:
> Hello GTK2HS experts,
> 
> I am using Graphics.UI.Gtk.ModelView.ListStore to store and display a
> list of records. Using listStoreGetValue I can retrieve an entry of the
> list at a given index. Now, I want to iterate over the model, e.g. to
> write each list entry into a file. How do I determine the length or the
> end of the list? I did not find any function(s) for this. What is the
> way to go?

The stores in the ModelView directory aren't quite complete yet. I
noticed the absence of a function with which you can get the full store.
These function are in the repository, but obviously weren't in the last
release. There is now a function:

listStoreToList :: ListStore a -> IO [a]

which retrieves the whole content as a list. You could workaround by
extracting element by element until the function listStoreGetValue
throws an exception. This sucks, but then you could perhaps use this
function whenever your application is built against the current release
of Gtk2Hs.

Sorry about this,
Axel.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
(Continue reading)

Axel Simon | 4 Oct 2007 15:53
Picon
Favicon

Re: mouse button patch (for buttons 4,5,6,7)

On Thu, 2007-10-04 at 13:44 +0000, kahl <at> cas.mcmaster.ca wrote:
> > 
>  > X Windows only deals with up to five button and buttons four and five
>  > are the wheel and therefore don't show up as mouse presses.
> 
> But that is only because of
> 
>         Option          "ZAxisMapping"          "4 5"
> 
> in xorg.conf?

Yes, probably. But then, I think that is the default nowadays. I guess
we shouldn't crash in either way, so the patch is worthwhile. I just
wondered whether we could put something in as a comment to say that the
wheel is handled differently, i.e. not as mouse buttons.

Axel.

> 
> Wolfram
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Gtk2hs-users mailing list
> Gtk2hs-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gtk2hs-users
(Continue reading)

haskell | 4 Oct 2007 16:17

Re: mouse button patch (for buttons 4,5,6,7)

Axel Simon wrote:
> On Thu, 2007-10-04 at 13:44 +0000, kahl <at> cas.mcmaster.ca wrote:
>>  > X Windows only deals with up to five button and buttons four and five
>>  > are the wheel and therefore don't show up as mouse presses.
>>
>> But that is only because of
>>
>>         Option          "ZAxisMapping"          "4 5"
>>
>> in xorg.conf?
> 
> Yes, probably. But then, I think that is the default nowadays. I guess
> we shouldn't crash in either way, so the patch is worthwhile. I just
> wondered whether we could put something in as a comment to say that the
> wheel is handled differently, i.e. not as mouse buttons.
> 
> Axel.

The documentation at
http://library.gnome.org/devel/gdk/unstable/gdk-Event-Structures.html#id2919978
claims

"guint button; 	the button which was pressed or released, numbered from 1 to 5.
Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the
right button. On 2-button mice, the middle button can often be simulated by
pressing both mouse buttons together."

So while I do not use gtk/gtk2hs I suspect that the button index can only reach
up to 5 in the present code.

(Continue reading)

Peter Hercek | 4 Oct 2007 16:35
Favicon

Re: mouse button patch (for buttons 4,5,6,7)

haskell <at> list.mightyreason.com wrote:
> Axel Simon wrote:
> The documentation at
> http://library.gnome.org/devel/gdk/unstable/gdk-Event-Structures.html#id2919978
> claims
> 
> "guint button; 	the button which was pressed or released, numbered from 1 to 5.
> Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the
> right button. On 2-button mice, the middle button can often be simulated by
> pressing both mouse buttons together."
> 
> So while I do not use gtk/gtk2hs I suspect that the button index can only reach
> up to 5 in the present code.
> 
> That said, it is also apparent that they could easily extend this in future
> releases to any guint value.
> 
> So why are MouseButton6 and 7 needed?
> 
>>   data MouseButton = LeftButton
>>                   | MiddleButton
>>                   | RightButton
>>                   | MouseButton4
>>                   | MouseButton5
>>                     deriving (Eq,Show)
> 
> If you want to be paranoid about crashing, then you would need:
> 
>>   data MouseButton = LeftButton
>>                   | MiddleButton
(Continue reading)


Gmane