koral | 23 Feb 16:48 2015

Pending pull-requests on webkit


Is anyone watching webkit's github repository ? I've made a pull request a month ago, without response, and
there's another one from Oct 2014... Maybe the owners weren't notified ?


Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
Norbert Zeh | 29 Oct 22:37 2014

Allocation data type not exported

Hi folks,

I just tried to connect to the sizeAllocate signal of the Widget type, but the type of this signal is Signal self (Allocation -> IO ()).  Thus, the function I provide as an argument needs to take an Allocation as an argument, but I cannot declare a function of this type because Allocation seems to be only exported by the hidden module Graphics.UI.Gtk.General.Structs.  Any advice on how to react to sizeAllocate signals?

Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net
Norbert Zeh | 10 Sep 13:37 2014

A few suggested improvements

Hi folks,

First of all, thanks for gtk2hs.  It's already awesome.  There are a number of improvements I would suggest and I may even be willing to work on if I can find the time.

#1:  This one is a 10-second programming effort and is really necessary, I think.

The current definition of EventM is

type EventM t a = ReaderT (Ptr t) IO a

This is unfortunate because it prevents users from wrapping this in a monad transformer, for example to carry application state around.  For example, if I were to try to define an action

doSomething :: StateT MyState (EventM any) Bool

the compiler complains because EventM expects two type arguments and was given only one.  The fix is simple:  Change the definition of EventM to

type EventM t = ReaderT (Ptr t) IO.

(Arguably, the plumbing should be hidden and EventM should be a newtype, but that would be more effort because it probably requires changes elsewhere in the gtk2hs code base.)

#2:  MonadIO and type classes for EventM and Render

Let me start by saying that I am not sure how hard this is to do, but it would help users a lot.  Again, the motivation is that applications often use monad transformers to carry state around, so the main monad may not be IO but something like StateT MyState IO.  Now using pretty much all the standard gtk functions requires cluttering the code with lots of calls to liftIO.  Changing the type signature of all gtk2hs functions as illustrated here for buttonNew would solve this:  Currently, the type of buttonNew is

buttonNew :: IO Button

Can't we make it

buttonNew :: MonadIO m => m Button ?

This would eliminate the need for lifting in the user code.  The same reasoning applies to Render and EventM, except that it requires more effort because one would have to define type classes such as MonadEventM and MonadRender.  The lack of this approach for EventM is quite a bit more annoying than the need to sprinkle liftIO's throughout the code because passing an event handler wrapped in a StateT transformer or similar to "on" explicitly requires packing and unpacking the state.

Let me close by saying once more that I am happy gtk2hs exists because, even though I say "annoying" above, it would be more annoying not to have gtk2hs for GUI development in Haskell.  Thanks for your efforts, guys.

Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net
Axel Simon | 15 May 10:16 2014

webkit woes

Hi Daniel,

I'm attaching a patch to fix a parsing issue that gtk's c2hs has on Mac OS. I've tried to compile koral's
webkit problem but I'm still struggling.


"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net
Axel Simon | 15 May 10:16 2014

webkit woes

Hi Daniel,

I'm attaching a patch to fix a parsing issue that gtk's c2hs has on Mac OS. I've tried to compile koral's
webkit problem but I'm still struggling.


"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net
Donald Allen | 19 Feb 02:17 2014

Popup menu trouble

I am trying to pop up a menu when the right button is pressed with the cursor in a particular treeview. I set up the event handler as follows:

-- Handle buttonPressEvent within the view
on view buttonPressEvent (tryEvent (do button <- eventButton
                                       theTime <- eventTime
                                       case button of
                                          RightButton -> liftIO (mouseButtonPressed theTime accountRegister globals)
                                          _ -> stopEvent))


mouseButtonPressed :: TimeStamp -> AccountRegister -> Globals -> IO ()
mouseButtonPressed theTime accountRegister globals
   = do menu <- menuNew
        print "mouseButtonPressed called"
        print ("time", theTime)
        menuItem <- menuItemNewWithLabel "New transaction (ctrl-n)"
        on menuItem menuItemActivated (newTransaction accountRegister globals)
        menuShellAppend menu menuItem
        menuItem <- menuItemNewWithLabel "Duplicate selected transaction (ctrl-d)"
        menuShellAppend menu menuItem
        widgetShowAll menu
        print "about to call menuPopup"
        menuPopup menu (Just (RightButton, theTime))

The first time I press the right button, the menu appears for perhaps 10 seconds and then disappears. During that time, I can click 'New transaction' and the right thing happens. The second time I press the right button, the menu appears very briefly, less than a second and then disappears. Subsequent right clicks behave the same. In other words, useless.

The debugging prints in mouseButtonPressed all appear in response to the right clicks. The event time advances, as you would expect.

I'm at a complete loss as to what might be causing this and can't continue with my project if this is not solved. Any suggestions would be appreciated.

Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net
Donald Allen | 13 Feb 19:40 2014

Some issues


The documentation says "the two primary areas of the window can be
accessed using dialogGetUpper and dialogGetActionArea." There is no
dialogGetUpper. Is it now dialogGetContentArea?

The documentation says "The top section is a VBox,". If dialogGetUpper
has been replaced by dialogGetContentArea, the latter returns an IO
Widget, not a Vbox and Widget is not in the ContainerClass. So how do
put something in the content area? In the C version of my project,
which of course uses gtk3 directly, I simply do a gtk_container_add to
the content area of the dialog. Works fine. The Haskell compiler won't
allow this, because, as I said above, Widget is not in the
ContainerClass, so I can't do a containerAdd. Can someone enlighten me
as to how one adds, say, a calendar, to the container area of a


In the Signals section, we have

onDaySelected :: CalendarClass self => self -> IO () -> IO (ConnectId self)

This is a function, not a signal. It cannot be used with 'on'. I
suspect what is going on here is that a change has been made from
functions like this, with the signal name embedded in the function, to
use of 'on', which takes a signal as an argument. The latter makes
much more sense to me, a better design, in my opinion. But it looks
like the transition is only partly done. If I'm right about this, it
would really be helpful to warn users of this, and refer them to
documentation for how to use the old-style and new-style signal
connection. Perhaps I missed it, but I've found nothing in the
documentation that says anything about this. Or perhaps I've got this
wrong, in which case I'd appreciate an explanation.

/Don Allen

Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
Donald Allen | 24 Jan 15:52 2014

Error when adding nodes to a tree store in response to testExpandRow

I've written a personal finance manager, having become dissatisfied
with Gnucash after many years of use. My own system, Newcash, is
written in C/GTK3/Sqlite3 (I will be making it available via github
when the documentation is ready). In recent months, I've become
interested in Haskell (I've written a lot of Lisp and Scheme code over
the years) and I re-wrote the Newcash report generator (originally
written in Python to process Gnucash's xml file and thus was pretty
ugly and needed re-writing) in Haskell. Enthusiastic about the
language and pleased with the performance of the report generator, I
decided to experiment with re-writing Newcash itself in Haskell, for
all the reasons that Haskell is to be preferred to C.

But I've run into a show-stopper. Here's the situation: the Newcash
initial window displays the tree of accounts. Not wanting to endure
long startup times (a big issue with Gnucash), I initially want to
populate the tree model with the root, its children, and its
grandchildren. The root gets expanded, so the children are visible,
but the grandchildren are present, so the children are expandable. A
callback is set up to handle the TreeView's testExpandRow signal,
indicating that the user has requested expansion of one of the nodes.
I do this initial setup of the accounts window prior to calling
mainGUI the first time. This all works fine.

The trouble starts if I try to expand one of the root's children by
clicking it. The root's grandchildren are already present, but
callback attached to the testExpandRow needs to add the grandchildren
of the clicked node, so that if it has children, it will appear
expandable. The callback receives both an iter and a path to the
clicked node. It uses the path in a loop that adds the grandchildren
of the clicked node to the TreeStore. This succeeds, but when the
callback returns, I get an error message:

** (Newcash:920): CRITICAL **: gtk2hs_store_iter_has_child: assertion
'iter->stamp == store->stamp' failed

and the display fails to refresh, with the clicked node expanded. If I
click the same node again, it expands correctly (the grandchildren are
already present, courtesy of the response to the previous click).

I'm guessing that the iter being passed to the callback (which I don't
use; as mentioned before, the insertion of the grandchildren is done
using the path derived from the path of the clicked node, using
treeStoreInsert) has a time-stamp as of the time the first
testExpandRow signal was issued. In response to that signal, I add
some nodes to the store. I'm guessing that doing so updates the
time-stamp on the store and that the two time-stamps are compared upon
return from signal processing, and they are no longer equal. The
second click does nothing to the store (my callback is smart enough to
know that a node has already been processed and doesn't add its
grandchildren twice), so the second time the node is clicked, the
time-stamp comparison works.

CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
Hamish Mackenzie | 18 Nov 03:19 2013


I am keen to get updated Gtk2Hs packages into Hackage (so that I can do the 
same for Leksah).

If someone grants me (HamishMackenzie) access, I would be happy to upload 
candidate packages to Hackage.

I have updated the version numbers and pointed the Source-Repository 
fields to point at github 

I am not aware of any outstanding bugs.

To make it easier to install Gtk2Hs on Windows I have added the header 
files, import libraries and pkg-config files to the latest Leksah binary 

To build Gtk2Hs on Windows

 * Download Leksah binary - current one is...
 * Install Leksah in C:\Leksah (or another dir without spaces in the path)
 * Add C:\Leksah\bin to your PATH
 * Follow the instructions here... https://github.com/gtk2hs/gtk2hs

I would like to do the same for OS X, but the Leksah OS X binary uses the 
macports libiconv (so it would not work with the standard builds of GHC).


DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
Hamish Mackenzie | 5 Oct 09:36 2013

Moving gtk2hs, gtksourceview and webkit to git and github

Ben suggested it might be a good way to make it easier for people to contribute.  I agree.  There are lots of
great tools for git (I use SmartGit all the time) and we can set up Travis-CI.


October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
Ben Gamari | 22 Sep 17:00 2013

Package name and gtk3

Since Daniel Wagner's patch[1] from 11 July 2012, gtk/gtk.cabal in the
gtk2hs repository declares the package name to be gtk3. This is a fine
approach to take for differentiating the Gtk3 bindings from their Gtk2
counterparts but the implementation needs to be finished.

In addition to editing gtk.cabal, the patch also adds gtk.cabal-0 and
gtk.cabal-3. The naming of these files is quite mysterious (why does the
Gtk 2 cabal file end in "-0"?) and it's completely unclear how to
convince cabal-install to build bindings for a given Gtk version short
of copying one of these files over gtk.cabal. At very least, we need to
add some notes to INSTALL describing how to build both the Gtk3 and
Gtk2 bindings.

Really, it would be better if things were laid out in such a way that
the desired workflow was apparent to a moderately experienced Haskeller.
One way to accomplish this would be,

  * remove gtk/gtk.cabal
  * move gtk/gtk.cabal-0 to gtk2/gtk.cabal and gtk/gtk.cabal-3 to
  * possibly rename gtk/ to gtk-common/ to suggest to the user that this
    directory contains no package of its own
  * add hs-source-dirs definitions pointing to gtk/ to both files
  * move Gtk2/3 specific files in gtk-common/ to the appropriate
    version-specific directory
  * Of course, update installation documentation in INSTALL



- Ben

[1] https://github.com/bgamari/gtk2hs/commit/adf06373654d32b5b5838b813807faeb8bb3819b
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
Gtk2hs-devel mailing list
Gtk2hs-devel <at> lists.sourceforge.net