JeanJouX
JeanJouX

Reputation: 2721

Gtk2Hs : Missing functions when migrating from Gtk2 to Gtk3

I wrote a Haskell program with Gtk2Hs dealing with Gtk2. But when I tried to build my program with Gtk3, GHC complains about missing functions which doesn't exist anymore :

• Variable not in scope:
    widgetGetSize :: GtkGL.GLDrawingArea -> IO (Integer, Integer)

• Variable not in scope:
    renderWithDrawable :: t1 -> Render () -> IO ()

Do you know if there are functions in Gtk3 which could replace these functions ?

Is there another way in Gtk3 to get the size of a widget ?


Note : I still can build my program with Gtk2 but I woulk like to anticipate a full migration to Gtk3

Upvotes: 0

Views: 92

Answers (1)

José Fonte
José Fonte

Reputation: 4104

GtkGLArea — A widget for custom drawing with OpenGL

API: ( C ) ( Vala )

GtkGLArea is a widget that allows drawing with OpenGL.

GtkGLArea sets up its own GdkGLContext for the window it creates, and creates a custom GL framebuffer that the widget will do GL rendering onto. It also ensures that this framebuffer is the default GL rendering target when rendering.

In order to draw, you have to connect to the “render” signal, or subclass GtkGLArea and override the GtkGLAreaClass.render() virtual function.

The GtkGLArea widget ensures that the GdkGLContext is associated with the widget's drawing area, and it is kept updated when the size and position of the drawing area changes.

GtkWidget Size

To get the widget size, use the GtkAllocation getters. Notice that GtkWidget has request size methods but the allocated size may differ.

Upvotes: 0

Related Questions