Giter VIP home page Giter VIP logo

gtk2hs's Introduction

Gtk2Hs

Gtk2Hs is a GUI library for Haskell based on GTK+. GTK+ is an extensive and mature multi-platform toolkit for creating graphical user interfaces.

For all new application development you should consider using haskell-gi as it has much more complete bindings. Cairo and WebKitGTK JavaScriptCore do not have GObject introspection data so you will still need to use the Gtk2Hs packages for those (even when using haskell-gi for everything else).

Installing C libraries

The following commands will install most of the C libraries used by the Gtk2Hs and haskell-gi.

Fedora

sudo dnf install gobject-introspection-devel webkitgtk3-devel webkitgtk4-devel gtksourceview3-devel

Ubuntu/Debian

sudo apt-get install libgirepository1.0-dev libwebkitgtk-3.0-dev libwebkit2gtk-4.0-dev libgtksourceview-3.0-dev

Arch Linux

sudo pacman -S gobject-introspection gobject-introspection-runtime gtksourceview3 webkitgtk webkit2gtk

OS X MacPorts

sudo port install gobject-introspection webkit-gtk3 webkit2-gtk gtksourceview3 gtk-osx-application-gtk3 adwaita-icon-theme

You will also need to build a MacPorts compatible of GHC. First install GHC some other way then unpack the source for the GHC version you want to use and run:

sudo port install libxslt gmp ncurses libiconv llvm-3.5 libffi
./configure --prefix=$HOME/ghc-8.0.1 --with-iconv-includes=/opt/local/include --with-iconv-libraries=/opt/local/lib --with-gmp-includes=/opt/local/include --with-gmp-libraries=/opt/local/lib --with-system-libffi --with-ffi-includes=/opt/local/lib/libffi-3.2.1/include --with-ffi-libraries=/opt/local/lib --with-nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm-classic
make
make install

Then make sure the $HOME/ghc-8.0.1/bin is in your $PATH.

OS X Homebrew

Unlike MacPorts you will not need a custom build of GHC for homebrew since it uses the system libiconv. However some packaged (such as WebKitGTK) seem to be less well supported on Homebrew.

brew install gtk+3

And if you got an error about that pkg-config can not find libffi when installing haskell-gi or something like that, you need to find out where your brew installed libffi, and add the pkg_config(e.g. /usr/local/Cellar/libffi/3.0.13/lib/pkgconfig) directory to $PKG_CONFIG_PATH.

TIPS: If you installed GTK with homebrew, you do not need to install X11 on macOS. The one installed by brew was linked with GTK+'s Quartz backend, and you can use macOS's native display manager, keyboard, and pointing device.

Windows MSYS2

Install MSYS2 and Chocolatey. Then in a shell with administrator privileges:

choco install ghc
pacman -S mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-gtksourceview3 mingw64/mingw-w64-x86_64-webkitgtk3

Install Extra Tools

cabal update
cabal install alex happy
cabal install haskell-gi

(make sure ~/.cabal/bin is in PATH)

Building with stack

While you currently cannot have the tools automatically installed with stack you should be able to install them in the local stack. For instance here are the build instructions for building Leksah using stack:

git clone --recursive https://github.com/leksah/leksah.git
cd leksah
stack install alex happy
stack install haskell-gi
stack install gtk2hs-buildtools
stack install

gtk2hs's People

Contributors

bgamari avatar bodigrim avatar catherineh avatar chris-martin avatar cmcq avatar dcoutts avatar deepfire avatar dmwit avatar hamishmack avatar hvanthiel avatar int-e avatar javran avatar jm4games avatar jmillikin avatar johnlato avatar l29ah avatar manateelazycat avatar mgsloan avatar mtesseract avatar mux avatar obbele avatar ocharles avatar pauljohnson avatar petertdavies avatar peti avatar pgavin avatar ryanglscott avatar vincenthz avatar vmchale avatar wrvn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtk2hs's Issues

OSX build fail

Using ghc 7.8.3 and gtk+3 3.14.1 from homebrew.

[118 of 200] Compiling Graphics.UI.Gtk.Multiline.TextTagTable ( dist/build/Graphics/UI/Gtk/Multiline/TextTagTable.hs, dist/build/Graphics/UI/Gtk/Multiline/TextTagTable.o )

Graphics/UI/Gtk/Multiline/TextTagTable.chs:89:3:
    Couldn't match type ‘CInt’ with ‘()’
    Expected type: IO ()
      Actual type: IO CInt
    In the expression:
      (\ (TextTagTable arg1) (TextTag arg2)
         -> withForeignPtr arg1
            $ \ argPtr1
                -> withForeignPtr arg2
                   $ \ argPtr2 -> gtk_text_tag_table_add argPtr1 argPtr2)
        (toTextTagTable self) (toTextTag tag)
    In an equation for ‘textTagTableAdd’:
        textTagTableAdd self tag
          = (\ (TextTagTable arg1) (TextTag arg2)
               -> withForeignPtr arg1
                  $ \ argPtr1 -> withForeignPtr arg2 $ \ argPtr2 -> ...)
              (toTextTagTable self) (toTextTag tag)
Failed to install gtk3-0.13.0.2

comboBoxNewText does not display strings

Combo boxes do not display strings using the gtk3 package, but the same code works when linked to the gtk2 package. This code is from the question I posted on stackoverflow: http://stackoverflow.com/questions/21591618/combobox-doesnt-show-any-of-its-strings/21594858

import Graphics.UI.Gtk
import Control.Monad.IO.Class

main = do
  initGUI
  window <- windowNew
  set window [windowTitle := "Table", containerBorderWidth := 20,
              windowDefaultWidth := 800, windowDefaultHeight := 600]

  table <- tableNew 10 10 True
  containerAdd window table 
  lbox <- hBoxNew False 0
  rbox <- hBoxNew False 0
  tableAttachDefaults table lbox 0 3 0 10
  tableAttachDefaults table rbox 3 10 0 10

  cb <- comboBoxNewText
  comboBoxAppendText cb "test"
  boxPackStart lbox cb PackGrow 10

  on window deleteEvent $ liftIO mainQuit >> return False
  widgetShowAll window
  mainGUI

event handling documentation

Hi,

thank you all for updating Gtk bindings.

I am using gtk2hs Gtk3 for the first time, and I have some problems with understanding how to bind events to actions. It seems that the 'on' combinator is the way to go, however I can't find any documentation on hackage (doc link broken on hackage) or tutorial on it.

Could someone knowledgeable please do something, even some little thing, to fill this gap ? Event handling is a central part of the Gtk system, and we really need to make sure it is properly understood by users. A proper documentation as well as a little tutorial to cover most common usages would be absolutely awesome.

Thank you very much,

Couldn't match expected type `Bool' with actual type `Int#'

gtk2hs-buildtools-0.12.5.2...

Dependency array ==0.5.0.0: using array-0.5.0.0
Dependency base ==4.7.0.0: using base-4.7.0.0
Dependency containers ==0.5.5.1: using containers-0.5.5.1
Dependency directory ==1.2.1.0: using directory-1.2.1.0
Dependency filepath ==1.3.0.2: using filepath-1.3.0.2
Dependency hashtables ==1.1.2.1: using hashtables-1.1.2.1
Dependency pretty ==1.1.1.1: using pretty-1.1.1.1
Dependency process ==1.2.0.0: using process-1.2.0.0
Dependency random ==1.0.1.1: using random-1.0.1.1

Using compiler: ghc-7.8.2

dist\build\gtk2hsC2hs\gtk2hsC2hs-tmp\CLexer.hs:463:29:
    Couldn't match expected type `Bool' with actual type `Int#'
    In the first argument of `(&&)', namely `(offset >=# 0#)'
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

dist\build\gtk2hsC2hs\gtk2hsC2hs-tmp\CLexer.hs:463:48:
    Couldn't match expected type `Bool' with actual type `Int#'
    In the second argument of `(&&)', namely `(check ==# ord_c)'
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

Update issue tracker link

Project website give http://trac.haskell.org/gtk2hs as issue tracker whereas it's not possible to report any issue there (even being logged), unlike there on github.

Should be useful to update link to the right place where issues must be reported.

Custom CellRenderer

Hello,

Is it possible to implement custom CellRenderer in haskell for Gtk3 ?

Thanks.

Signal handler for queryTooltip isn't triggered even if widgetHasTooltip is enabled

I guess this is a bug in gtk2hs. I've modified the hello world code from gtk2hs and pygtk to make sure if it's a bug in gtk2hs.

https://gist.github.com/maoe/f8ad8b80bb170c97a6e1

With the Python code, when you move your cursor over the button you'll get query-tooltop handler messages in the console. As for the Haskell code, you don't get any messages.

  • OS: Ubuntu LTS 12.04
  • GTK: libgtk2.0-dev 2.24.10-0ubuntu6.1
  • gtk2hs: 0.12.4
  • pygtk: 2.24.0-3

Allocation isn't exported

The sizeAllocate event gives me an Allocation value, but it isn't exported so there's nothing I can do with it.

Buildtools failing to compile

I get this error when trying to compile:
dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.hs:463:29:
Couldn't match expected type ‘Bool’ with actual type ‘Int#’
In the first argument of ‘(&&)’, namely ‘(offset >=# 0#)’
In the expression: (offset >=# 0#) && (check ==# ord_c)
In the expression:
if (offset >=# 0#) && (check ==# ord_c) then
alexIndexInt16OffAddr alex_table offset
else
alexIndexInt16OffAddr alex_deflt s

dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.hs:463:48:
Couldn't match expected type ‘Bool’ with actual type ‘Int#’
In the second argument of ‘(&&)’, namely ‘(check ==# ord_c)’
In the expression: (offset >=# 0#) && (check ==# ord_c)
In the expression:
if (offset >=# 0#) && (check ==# ord_c) then
alexIndexInt16OffAddr alex_table offset
else
alexIndexInt16OffAddr alex_deflt s
Failed to install gtk2hs-buildtools-0.13.0.2
cabal: Error: some packages failed to install:
gtk2hs-buildtools-0.13.0.2 failed during the building phase. The exception was:
ExitFailure 1

I'm using a Retina MBP running Mac OS 10.10, ghc version 7.8.3, and cabal-install version 1.20.0.3

Steps to reproduce:
$ git clone https://github.com/gtk2hs/gtk2hs
$ cd gtk2hs
$ cabal install ./tools

I've tried fiddling with the source file, but all I've managed to do is make ghc spit out a parse error instead of the one above, which leads me to suspect an indentation issue.

putting poppler library as one of gtk2hs repo

This is a general request for the gtk2hs team, not this specific gtk2hs/gtk2hs repo.

I am currently maintaining haskell poppler binding (http://github.com/wavewave/poppler) I think pdf rendering library is of general interest to many people who use gtk2hs, so I am suggesting to have a clone of poppler in gtk2hs organization, so that many people may see it here and recognize its existence. The addition of poppler in the gtk2hs team github may be regarded as a similar level of integration as having svgcairo or webkit library here.

Failure to install: gtk2hsC2hs: Error in C header file.

~/Dropbox/Private/Pantheon $ ~/.cabal/bin/cabal install cairo
Resolving dependencies...
[1 of 2] Compiling SetupWrapper     ( /var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/SetupWrapper.hs, /var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/dist/setup/SetupWrapper.o )

/var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/SetupWrapper.hs:118:28: Warning:
    In the use of ‘configCompiler’
    (imported from Distribution.Simple.Configure):
    Deprecated: "'configCompiler' is deprecated. Use 'configCompilerEx' instead."
[2 of 2] Compiling Main             ( /var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/Setup.hs, /var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/dist/setup/Main.o )
Linking /var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/cairo-0.12.5.3-16331/cairo-0.12.5.3/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring cairo-0.12.5.3...
Building cairo-0.12.5.3...
Preprocessing library cairo-0.12.5.3...
gtk2hsC2hs: Error in C header file.

/usr/include/stdio.h:437: (column 138) [FATAL] 
  >>> Syntax error!
  The symbol `=' does not fit here.

Failed to install cairo-0.12.5.3
cabal: Error: some packages failed to install:
cairo-0.12.5.3 failed during the building phase. The exception was:
ExitFailure 1

Is gtk-mac-integration dead, ige-mac-integration the new one?

As title implies, is this the case currently?

Also, I tried cabal install ige-mac-integration and got:

/var/folders/31/fdpzgydn611cp5mly2p9hv3c0000gn/T/ige-mac-integration-0.1.0.1-25421/ige-mac-integration-0.1.0.1/Gtk2HsSetup.hs:295:69:
Not in scope: `libraryConfig'
Failed to install ige-mac-integration-0.1.0.1
cabal: Error: some packages failed to install:
ige-mac-integration-0.1.0.1 failed during the configure step. The exception
was:
ExitFailure 1

Not in scope onDestroy

If I try to compile the tutorial I get an compiling error stating that onDestroy is not in scope.

I'll post the exact code and error message as soon as I'm back at my PC.

glib can't be installed

when I tryed to install it. This error occured:

System/Glib/UTFString.hs:67:9:
Module Data.Text.Foreign' does not exportwithCStringLen'

System/Glib/UTFString.hs:67:25:
Module Data.Text.Foreign' does not exportpeekCStringLen'
Failed to install glib-0.13.0.1
cabal: Error: some packages failed to install:
glib-0.13.0.1 failed during the building phase. The exception was:
ExitFailure 1

No Binding for gtk_accel_group_new ()

gtk and gtk3 contain bindings for functions which operate on AccelGroups but no binding for the AccelGroup constructor exists, making it impossible to use these functions.

Bindings are actually missing for every function listed in Accelerator Groups but the missing constructor is most notable since it is required by bindings which do exist.

Missing function to get a pixbuf from DrawWindow.

I would like to get a pixbuf from gdk window, but this function are missing.
I found a pixbufNewFromSurface function:

pixbufNewFromSurface :: Surface -> Int -> Int -> Int -> Int -> IO Pixbuf

Creates a new pixbuf from a cairo Surface.

Transfers image data from a cairo Surface and converts it to an RGB(A) representation
inside a Pixbuf. This allows you to efficiently read individual pixels from cairo surfaces.
For GdkWindows, use gdk_pixbuf_get_from_window() instead.

The gdk_pixbuf_get_from_window is just what I need.

Where is the master ?

Hi,

I have recently cloned the GTK2Hs darcs repository. Now I just discovered this git repository, as well as Ben Gamari's bgamari/gtk2hs.

Hamish wrote on reddit that a release to hackage should happen soon, which is an excellent news given the unability to built current hackage gtk2hs with current cabal.

I am wondering what the relationships are between those 3 repositories ? Hamish, do you work with ben ? I am not a github wizzard, but at a first glance the two repos are not linked. They definitly share some history (from darcs I guess), but I don't know if changes can be pulled between them.

Thanks for clarifying this, and thank you for releasing asap a fixed gtk to hackage.

Regards,

gtk3: Not in scope: type constructor or class `CULLong`

A similar error message is thrown many many times when I try to build gtk3-0.12.5.6. The last one is:

Graphics\UI\Gtk\Types.chs:5599:32:
    Not in scope: type constructor or class `CULLong'
    Perhaps you meant `CULong' (imported from Foreign.C.Types)

I am using the last Haskell Platform, which means GHC 7.6.3 and base-4.6.0.1. Sorry if this is solved in HEAD and I didn't notice it.

Thank you.

exploit?

anti virus scanner found an exploit in glib-2.40.2: exp/png.c in file gentoo/var/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2/gio/tests/thumbnails/huge-chunk-size.png

configCompilerEx is only available in Cabal > 1.18

configCompilerEx was only introduced in Cabal 1.18: this makes it harder to build gtk2hs
with older haskell-platforms (eg ghc-7.6):

[1 of 2] Compiling SetupWrapper     ( /home/petersen/tmp/cairo-0.13.0.1-8200/cairo-0.13.0.1/SetupWrapper.hs, /home/petersen/tmp/cairo-0.13.0.1-8200/cairo-0.13.0.1/dist/setup/SetupWrapper.o )

/home/petersen/tmp/cairo-0.13.0.1-8200/cairo-0.13.0.1/SetupWrapper.hs:12:39:
    Module
    `Distribution.Simple.Configure'
    does not export
    `configCompilerEx'
Failed to install cairo-0.13.0.1

I think it would be better to just say Cabal-Version: >= 1.18 or condition on Cabal version.
Not sure which is prettier... :)

Error on attempting to add nodes to tree store in response to testExpandRow signal

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.

can't set up on windows

gtk2hs builds and install for me, however when I try to install my gtk application I get linking errors.
The GTK apps runs just fine under linux... No matter what I do I can't make it work under windows though...

Loading package cairo-0.12.5.3 ... linking ... done.
Loading package glib-0.12.5.4 ... linking ... done.
Loading package gio-0.12.5.3 ... linking ... done.
Loading package directory-1.2.0.1 ... linking ... done.
Loading package process-1.1.0.2 ... linking ... done.
Loading package pango-0.12.5.3 ... ghc.exe: m: The specified module could not be
 found.
<command line>: can't load .so/.DLL for: m.dll (addDLL: could not load DLL)
Failed to install picdate-0.1.0.0
cabal: Error: some packages failed to install:
picdate-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1

gtk2hsC2hs is broken on Mac OS Mavericks

Trying to build cairo fails with this error:

Preprocessing library cairo-0.12.4...
gtk2hsC2hs: Error in C header file.

/usr/include/stdio.h:437: (column 138) [FATAL] 
  >>> Syntax error!
  The symbol `=' does not fit here.

I think the problem is that Mavericks' cpp is based on clang and has different command line arguments. The same problem affects ghc, and here's a thread discussing it in the context of home brew: Homebrew/legacy-homebrew#20546

When ghc's been fixed, I imagine the patch for gtk2hsC2hs will be obvious to anyone
who knows the code.

In the meantime, if you've installed e.g. gcc 4.8 then one way to work around the problem is to simply put links from gcc to gcc-4.8 earlier in the path, install cairo,
then remove them:

cd /usr/local/bin
ln -s gcc-4.8 gcc
ln -s cpp-4.8 cpp
cabal install cairo
rm gcc
rm cpp

It's hardly elegant though!

Test failures in glib and pango

Unpacking to glib-0.12.5.4/
Resolving dependencies...
[1 of 2] Compiling SetupWrapper     ( SetupWrapper.hs, dist/setup/SetupWrapper.o )

SetupWrapper.hs:118:28: Warning:
    In the use of ‘configCompiler’
    (imported from Distribution.Simple.Configure):
    Deprecated: "'configCompiler' is deprecated. Use 'configCompilerEx' instead."
[2 of 2] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.12.5.4...
Running Haddock for glib-0.12.5.4...
Preprocessing library glib-0.12.5.4...
gtk2hsC2hs: System/Glib/Types.chi not found in:
/var/lib/jenkins/workspace/Stackage/ghcversion/7.8.2/stackage/sandbox/lib/x86_64-linux-ghc-7.8.2/utf8-string-0.3.8
/opt/ghc/7.8.2/lib/ghc-7.8.2/containers-0.5.5.1
/opt/ghc/7.8.2/lib/ghc-7.8.2/base-4.7.0.0
dist/build
.
Unpacking to pango-0.12.5.3/
Resolving dependencies...
[1 of 2] Compiling SetupWrapper     ( SetupWrapper.hs, dist/setup/SetupWrapper.o )

SetupWrapper.hs:118:28: Warning:
    In the use of ‘configCompiler’
    (imported from Distribution.Simple.Configure):
    Deprecated: "'configCompiler' is deprecated. Use 'configCompilerEx' instead."
[2 of 2] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring pango-0.12.5.3...
Running Haddock for pango-0.12.5.3...
Preprocessing library pango-0.12.5.3...
gtk2hsC2hs: Graphics/Rendering/Pango/BasicTypes.chi not found in:
/opt/ghc/7.8.2/lib/ghc-7.8.2/process-1.2.0.0
/opt/ghc/7.8.2/lib/ghc-7.8.2/pretty-1.1.1.1
/var/lib/jenkins/workspace/Stackage/ghcversion/7.8.2/stackage/sandbox/lib/x86_64-linux-ghc-7.8.2/mtl-2.1.3.1
/var/lib/jenkins/workspace/Stackage/ghcversion/7.8.2/stackage/sandbox/lib/x86_64-linux-ghc-7.8.2/glib-0.12.5.4
/opt/ghc/7.8.2/lib/ghc-7.8.2/directory-1.2.1.0
/opt/ghc/7.8.2/lib/ghc-7.8.2/containers-0.5.5.1
/var/lib/jenkins/workspace/Stackage/ghcversion/7.8.2/stackage/sandbox/lib/x86_64-linux-ghc-7.8.2/cairo-0.12.5.3
/opt/ghc/7.8.2/lib/ghc-7.8.2/base-4.7.0.0
/opt/ghc/7.8.2/lib/ghc-7.8.2/array-0.5.0.0
dist/build

ComboBox madness

Hello,

I have spent hours trying to get a ComboBox populated with a simple model of the form (databaseId :: Int, name :: String). I want the name of the model to be displayed in the combobox, but I really need to get the databaseId value when reading the selected item.

I can't figure how to make that work. Could someone please document this in the demo ? Thank you.

Tray icons disappear very quickly if "-threaded" ghc-option is used

If the ghc option "-threaded" is used, tray icons will show up and then disappear after half a second.

How to reproduce:

  1. Save the following sample (test.hs):
import Graphics.UI.Gtk
import Graphics.UI.Gtk.Display.StatusIcon

main :: IO ()
main = do
  initGUI
  tray <- statusIconNewFromFile "test.jpg"
  mainGUI
  1. Place any image in the same directory as test.hs and name it test.jpg
  2. Compile without threaded and see if the image shows up properly in tray:
$ ghc test.hs
$ ./test # tray image should show up properly now
  1. Compile with threaded option, see how the tray icon disappears after a split second:
$ ghc -threaded test.hs
$ ./test # tray icon wont stay this time

gio 0.13.0 fails to install on ppc with cabal install

gio 0.13.0 fails to install on ppc with cabal install
I am using ghc-7.8 on debian

build log is as follows:

[1 of 2] Compiling SetupWrapper     ( /tmp/gio-0.13.0.0-20170/gio-0.13.0.0/SetupWrapper.hs, /tmp/gio-0.13.0.0-20170/gio-0.13.0.0/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/gio-0.13.0.0-20170/gio-0.13.0.0/dist/setup/setup.hs, /tmp/gio-0.13.0.0-20170/gio-0.13.0.0/dist/setup/Main.o )
Linking /tmp/gio-0.13.0.0-20170/gio-0.13.0.0/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring gio-0.13.0.0...
Building gio-0.13.0.0...
Preprocessing library gio-0.13.0.0...
[ 1 of 24] Compiling System.GIO.Signals ( dist/build/System/GIO/Signals.hs, dist/build/System/GIO/Signals.o )
[ 2 of 24] Compiling System.GIO.Types ( dist/build/System/GIO/Types.hs, dist/build/System/GIO/Types.o )
[ 3 of 24] Compiling System.GIO.Enums ( dist/build/System/GIO/Enums.hs, dist/build/System/GIO/Enums.o )
[ 4 of 24] Compiling System.GIO.File.FileAttribute ( dist/build/System/GIO/File/FileAttribute.hs, dist/build/System/GIO/File/FileAttribute.o )
[ 5 of 24] Compiling System.GIO.Volumes.VolumeMonitor ( dist/build/System/GIO/Volumes/VolumeMonitor.hs, dist/build/System/GIO/Volumes/VolumeMonitor.o )
[ 6 of 24] Compiling System.GIO.Icons.ThemedIcon ( dist/build/System/GIO/Icons/ThemedIcon.hs, dist/build/System/GIO/Icons/ThemedIcon.o )
[ 7 of 24] Compiling System.GIO.Icons.Icon ( dist/build/System/GIO/Icons/Icon.hs, dist/build/System/GIO/Icons/Icon.o )
[ 8 of 24] Compiling System.GIO.Icons.FileIcon ( dist/build/System/GIO/Icons/FileIcon.hs, dist/build/System/GIO/Icons/FileIcon.o )
[ 9 of 24] Compiling System.GIO.Icons.EmblemedIcon ( dist/build/System/GIO/Icons/EmblemedIcon.hs, dist/build/System/GIO/Icons/EmblemedIcon.o )
[10 of 24] Compiling System.GIO.Icons.Emblem ( dist/build/System/GIO/Icons/Emblem.hs, dist/build/System/GIO/Icons/Emblem.o )
[11 of 24] Compiling System.GIO.File.MountOperation ( dist/build/System/GIO/File/MountOperation.hs, dist/build/System/GIO/File/MountOperation.o )
[12 of 24] Compiling System.GIO.File.IOError ( dist/build/System/GIO/File/IOError.hs, dist/build/System/GIO/File/IOError.o )
[13 of 24] Compiling System.GIO.File.FileMonitor ( dist/build/System/GIO/File/FileMonitor.hs, dist/build/System/GIO/File/FileMonitor.o )
[14 of 24] Compiling System.GIO.File.FileInfo ( dist/build/System/GIO/File/FileInfo.hs, dist/build/System/GIO/File/FileInfo.o )

System/GIO/File/FileInfo.chs:269:5:
    ‘IO’ is applied to too many type arguments
    In the type signature for ‘fileInfoGetAttributeBool’:
      fileInfoGetAttributeBool :: (FileInfoClass info,
                                   GlibString string) =>
                                  info -> string -> IO Bool bool

System/GIO/File/FileInfo.chs:278:5:
    ‘IO’ is applied to too many type arguments
    In the type signature for ‘fileInfoGetAttributeWord32’:
      fileInfoGetAttributeWord32 :: (FileInfoClass info,
                                     GlibString string) =>
                                    info -> string -> IO Word32 bool

System/GIO/File/FileInfo.chs:287:5:
    ‘IO’ is applied to too many type arguments
    In the type signature for ‘fileInfoGetAttributeInt32’:
      fileInfoGetAttributeInt32 :: (FileInfoClass info,
                                    GlibString string) =>
                                   info -> string -> IO Int32 bool

System/GIO/File/FileInfo.chs:296:5:
    ‘IO’ is applied to too many type arguments
    In the type signature for ‘fileInfoGetAttributeWord64’:
      fileInfoGetAttributeWord64 :: (FileInfoClass info,
                                     GlibString string) =>
                                    info -> string -> IO Word64 bool

System/GIO/File/FileInfo.chs:305:5:
    ‘IO’ is applied to too many type arguments
    In the type signature for ‘fileInfoGetAttributeInt64’:
      fileInfoGetAttributeInt64 :: (FileInfoClass info,
                                    GlibString string) =>
                                   info -> string -> IO Int64 bool
Failed to install gio-0.13.0.0

Update tutorials

After I stumbled over some problems regarding the current way how events are handled and the way used in the Glade tutorial (see #30), I think someone should really update the tutorials!

I'd like to fork and give my best if the sources of the tutorial-texts would be available

Linkage error with GHC 7.8.2 cabal 1.18 on Windows

I got that message when linking gtk to my app:

Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package utf8-string-0.3.7 ... linking ... done.
Loading package cairo-0.12.5.3 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package glib-0.12.5.4 ... linking ... done.
Loading package gio-0.12.5.3 ... linking ... done.
Loading package Win32-2.3.0.2 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package pango-0.12.5.3 ... linking ... done.
Loading package gtk-0.12.5.7 ... linking ... ghc.exe: C:\Users\sqlserver\dhek-cu
rrent\.cabal-sandbox\i386-windows-ghc-7.8.2\gtk-0.12.5.7\HSgtk-0.12.5.7.o: unkno
wn symbol `__imp___fmode'
ghc.exe: unable to load package `gtk-0.12.5.7'

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I use the 32bits GHC version

failed to install glib on Windows 7

I am using cabal 1.20, GHC 7.6.3, the GTK bundle is gtk+-bundle_3.6.4-20131201_win64.

cabal install gtk3 failed and give the following errors:

In-place registering cairo-0.12.5.3...
setup.exe: Generate Reg File not supported
Failed to install cairo-0.12.5.3

In-place registering glib-0.12.5.4...
setup.exe: Generate Reg File not supported
Failed to install glib-0.12.5.4

Windows threading/mutex error

As error with GTK3/win mentionned there, we get the same error with GTK2:

message:Glib:ERROR:gthread-win32.c:640:g_thread_xp_AcquireSRWLockExclusive: assertion failed:(!lock->writer_locked)

It's reproduced on Win7 and WinXP, using glib/gtk libraries provided by MSYS2 (by pacman) on Win7, using built from sources glib/gtk on WinXP, with same error: as soon as window is altered (moved or resized), application is locked.

On Win7, same app (same .exe file) work by replacing .dll by those found there (extracted from GIMP). On WinXP even this 'workaround' can't make it work.

Considering other GTK/GLib apps (GIMP, Inkscape, Pidgin, ...) are working properly on same OSes (same VM), I don't think cause is GTK itself, but way it's used.

As Win7 workaround, using previous/older GTK/Glib .dll, I can guess some GTK or Glib changes for Win (gthread-win32) haven't been considered, so that hsgthread.c is no longer compliant.

TreeView doesn't vizualize tree from TreeStore

When I run this program, the treeView widget showed with white background and nothing else. I think, it's a bug but I'm not sure. Please don't shot me If I did some mistake. I asked at stack overflow and no one told me what to do, then I came to conclusion that it is a bug.

testTree :: Tree String
testTree =
    (Node "root" 
        [(Node "child" 
            [(Node "rose" []),
            (Node "cry" 
                [(Node "karma" [])])]),
        (Node "future" []),
        (Node "destiny" 
            [(Node "call" []),
            (Node "saw" [])]),
        (Node "reason" [])])

start :: IO ()
start =
    builderNew >>= (\builder ->
        builderAddFromFile builder "graphic.glade" >>
        builderGetObject builder castToWindow "mainWindow" >>= (\window ->
            widgetShowAll window >>
            windowMaximize window >>
            (window `on` deleteEvent) (liftIO (widgetDestroy window >> mainQuit >> return True))) >>
        builderGetObject builder castToTreeView "treeView" >>= (\tv -> 
            treeStoreNew [testTree] >>= (\ts ->
                treeViewSetModel tv ts)) >>
        return ())

gtkmain :: IO ()
gtkmain = 
    initGUI     >>  
    start >>
    mainGUI  

main = gtkmain

X11 interaction?

I want to use X11 for some low level calls.
Just wondering if the interactions between X11 and gdk are possible?
I found some related calls in GDK 3 Reference But I didn't find something corresponding to them in gtk2hs.

Windows: pkg-config reports missing x11

When compiling the following on Vista or on Wine (details for Wine at http://www.haskell.org/haskellwiki/GHC_under_Wine#Code_that_uses_gtk2hs)

cabal install LambdaHack-0.4.99.0

cabal reports

setup-Cabal-1.18.1.3-i386-windows-ghc-7.8.3.exe: The pkg-config package x11 is required but it could not be found

The following workaround works on both Vista and Wine (in the latter case, the binary, obtained after a few more workarounds, is confirmed to run correctly; for Vista, I've lost patience).

cp ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/fontconfig.pc ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/x11.pc

I'm only guessing it's a gtk2hs bug, and not GHC's nor cabal's.

Missing function to emit signals

I need emit signals (like mouse/keyboard events) into OffscreenWindow, but I don't understand how to do it.
In other words I would like to have something like g_signal_emit() GObject method.

displayGetDefault crashes or deadlock when ghc option -threaded is set

Graphics.UI.Gtk.Gdk.Display.displayGetDefault is unstable when -threaded is set. It doesn't always display an error but if you get lucky you can have:

_XPrivSyncFunction: Assertion 'dpy->synchandler == _XPrivSyncFunction' failed

Otherwise your application just freezes (due to deadlock).

GHC: 7.8.3
OS: Linux 3.15.7-1-ARCH
GTK binding version: 0.12.5.7

Does not build under Cabal 1.20

Both the hackage and git versions of glib fail to build under Cabal 1.20. I've tracked down the problem to line 171 of Gtk2HsSetup.hs ("Generate Reg File not supported" is also the relevant build output):

 _ | modeGenerateRegFile   -> die "Generate Reg File not supported"

It seems that, as of 1.20, Cabal will provide a regGenPkgConf flag to the register command if the package being built contains any libraries.

This problem exists for the other libraries as well.

Use of deprecated functions

While compiling gtk with GHC 7.9.20140308 I got a few deprecation warnings. I hear this is the project that I should be reporting them to. Let me know if I'm barking up the wrong tree. Here are the warnings:

Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘void gtk2hs_threads_initialise()’:

Graphics/UI/Gtk/General/hsgthread.cpp:82:5:
     warning: ‘void g_static_mutex_init(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:145): Use 'g_mutex_init' instead [-Wdeprecated-declarations]
         g_static_mutex_init(&gtk2hs_finalizer_mutex);
         ^

Graphics/UI/Gtk/General/hsgthread.cpp:82:48:
     warning: ‘void g_static_mutex_init(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:145): Use 'g_mutex_init' instead [-Wdeprecated-declarations]
         g_static_mutex_init(&gtk2hs_finalizer_mutex);
                                                    ^

Graphics/UI/Gtk/General/hsgthread.cpp:84:5:
     warning: ‘void g_thread_init(gpointer)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Wdeprecated-declarations]
         g_thread_init(NULL);
         ^

Graphics/UI/Gtk/General/hsgthread.cpp:84:23:
     warning: ‘void g_thread_init(gpointer)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Wdeprecated-declarations]
         g_thread_init(NULL);
                           ^

In file included from /usr/include/glib-2.0/glib.h:109:0:
    0,
                     from Graphics/UI/Gtk/General/hsgthread.cpp:36:
Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘void gtk2hs_g_object_unref_from_mainloop(gpointer)’:

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:19:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                       ^

Graphics/UI/Gtk/General/hsgthread.cpp:107:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:50:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                                                      ^

Graphics/UI/Gtk/General/hsgthread.cpp:107:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:21:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                         ^

Graphics/UI/Gtk/General/hsgthread.cpp:152:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:52:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                                                        ^

Graphics/UI/Gtk/General/hsgthread.cpp:152:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^
Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘gboolean gtk2hs_run_finalizers(gpointer)’:

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:19:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                       ^

Graphics/UI/Gtk/General/hsgthread.cpp:172:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:50:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                                                      ^

Graphics/UI/Gtk/General/hsgthread.cpp:172:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:21:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                         ^

Graphics/UI/Gtk/General/hsgthread.cpp:195:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:52:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                                                        ^

Graphics/UI/Gtk/General/hsgthread.cpp:195:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^
Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘void gtk2hs_threads_initialise()’:

Graphics/UI/Gtk/General/hsgthread.cpp:82:5:
     warning: ‘void g_static_mutex_init(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:145): Use 'g_mutex_init' instead [-Wdeprecated-declarations]
         g_static_mutex_init(&gtk2hs_finalizer_mutex);
         ^

Graphics/UI/Gtk/General/hsgthread.cpp:82:48:
     warning: ‘void g_static_mutex_init(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:145): Use 'g_mutex_init' instead [-Wdeprecated-declarations]
         g_static_mutex_init(&gtk2hs_finalizer_mutex);
                                                    ^

Graphics/UI/Gtk/General/hsgthread.cpp:84:5:
     warning: ‘void g_thread_init(gpointer)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Wdeprecated-declarations]
         g_thread_init(NULL);
         ^

Graphics/UI/Gtk/General/hsgthread.cpp:84:23:
     warning: ‘void g_thread_init(gpointer)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Wdeprecated-declarations]
         g_thread_init(NULL);
                           ^

In file included from /usr/include/glib-2.0/glib.h:109:0:
    0,
                     from Graphics/UI/Gtk/General/hsgthread.cpp:36:
Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘void gtk2hs_g_object_unref_from_mainloop(gpointer)’:

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:19:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                       ^

Graphics/UI/Gtk/General/hsgthread.cpp:107:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:50:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                                                      ^

Graphics/UI/Gtk/General/hsgthread.cpp:107:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:21:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                         ^

Graphics/UI/Gtk/General/hsgthread.cpp:152:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:52:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                                                        ^

Graphics/UI/Gtk/General/hsgthread.cpp:152:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^
Graphics/UI/Gtk/General/hsgthread.cpp: In function ‘gboolean gtk2hs_run_finalizers(gpointer)’:

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:19:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                       ^

Graphics/UI/Gtk/General/hsgthread.cpp:172:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:138:50:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_lock (g_static_mutex_get_mutex (mutex))
                                                      ^

Graphics/UI/Gtk/General/hsgthread.cpp:172:5:
     note: in expansion of macro ‘g_static_mutex_lock’
         g_static_mutex_lock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:126:34:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
     #define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl
                                      ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:21:
     note: in expansion of macro ‘g_static_mutex_get_mutex’
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                         ^

Graphics/UI/Gtk/General/hsgthread.cpp:195:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^

/usr/include/glib-2.0/glib/deprecated/gthread.h:142:52:
     warning: ‘GMutex* g_static_mutex_get_mutex_impl(GStaticMutex*)’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:149): Use 'GMutex' instead [-Wdeprecated-declarations]
         g_mutex_unlock (g_static_mutex_get_mutex (mutex))
                                                        ^

Graphics/UI/Gtk/General/hsgthread.cpp:195:5:
     note: in expansion of macro ‘g_static_mutex_unlock’
         g_static_mutex_unlock(&gtk2hs_finalizer_mutex);
         ^

Type error in Structs.hsc

After I configure with

cabal configure --with-gcc=gcc-4.9

and then build, I get

Graphics/UI/Gtk/General/Structs.hsc:660:3:
    Couldn't match type `CInt' with `Ptr a0'
    Expected type: IO (Ptr a0)
      Actual type: IO CInt
    In the return type of a call of `\ (Drawable drawable)
                                       -> withForeignPtr drawable gdk_x11_drawable_get_xid'
    In the second argument of `($)', namely
      `(\ (Drawable drawable)
          -> withForeignPtr drawable gdk_x11_drawable_get_xid)
         (toDrawable d)'
    In the expression:
      liftM toNativeWindowId
      $ (\ (Drawable drawable)
           -> withForeignPtr drawable gdk_x11_drawable_get_xid)
          (toDrawable d)

If instead I configure with the -fhave-quartz-gtk flag (which is what I actually really wanted), then I get a different error

Graphics/UI/Gtk/General/Structs.hsc:660:3:
    Couldn't match type `Maybe DrawWindow' with `Ptr a0'
    Expected type: IO (Ptr a0)
      Actual type: IO (Maybe DrawWindow)
    In the return type of a call of `\ (Drawable drawable)
                                       -> return $ Just (DrawWindow drawable)'
    In the second argument of `($)', namely
      `(\ (Drawable drawable) -> return $ Just (DrawWindow drawable))
         (toDrawable d)'
    In the expression:
      liftM toNativeWindowId
      $ (\ (Drawable drawable) -> return $ Just (DrawWindow drawable))
          (toDrawable d)

Graphics/UI/Gtk/General/Structs.hsc:675:32:
    Couldn't match type `Drawable' with `DrawWindow'
    Expected type: ForeignPtr DrawWindow
      Actual type: ForeignPtr Drawable
    In the first argument of `DrawWindow', namely `drawable'
    In the first argument of `Just', namely `(DrawWindow drawable)'
    In the second argument of `($)', namely
      `Just (DrawWindow drawable)'

This is on OSX Mavericks, ghc 7.6.3, GTK+ built from source, version 2.24.21.

`mainIteration` always returns `True`

It appears that mainIteration always returns True as if mainQuit was called every time.

How to reproduce

Take https://github.com/gtk2hs/gtk2hs/blob/master/gtk/demo/hello/World.hs and replace mainQuit with:

runGUI :: IO ()
runGUI = do
  exit <- mainIteration
  print exit
  runGUI 

will print:

True
True
True
True
True
[...]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.