caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Strauss <philippe@strauss-engineering.ch>
To: caml-list@inria.fr
Subject: [Caml-list] Lablgtk3 & Cairo & drawing area
Date: Fri, 15 Jan 2021 14:21:41 +0100	[thread overview]
Message-ID: <323ED0F3-84EA-443E-A63C-7EDDF1345A17@strauss-engineering.ch> (raw)

Hello ocaml users,

Using previously lablgtk2, I was using Cairo_gtk to get a Cairo context from a gdkwindow:

cairo_ctx <- Some (Cairo_gtk.create (self #area) #misc #window) ;

Now I want to definitively switch to Lablgtk3. Using the following:

cairo_ctx <- Some (Cairo.create (self #area) #misc #window) ;

I get this build error:

————8<--------
- build straightliner/plwrap plot2d.cmx
+ ocamlfind ocamlopt -package lablgtk3,cairo2,plplot,plcairo,react,batteries,logs,logs-ppx -warn-error -a -thread -inline 10 -I . -I /Users/philippe/mysrc/sp_base.ml -I sigproc -I /Users/philippe/mysrc/zfilters -I plwrap -I /Users/philippe/mysrc/sp_base.ml -c plot2d.ml
File "plot2d.ml", line 132, characters 44-70:
132 |             cairo_ctx <- Some (Cairo.create (self #area) #misc #window) ;
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type Gdk.window = [ `gdkwindow ] Gobject.obj
       but an expression was expected of type Cairo.Surface.t
————8<--------

How do I get from a gdkwindow to a Cairo surface.t, or more generally, what is wrong with my code?

TIA, Philippe.


--
I thought I caught you stealing from my cuckoo mind
        -- The House Of Love



             reply	other threads:[~2021-01-15 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 13:21 Philippe Strauss [this message]
2021-01-15 16:25 ` Philippe Strauss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=323ED0F3-84EA-443E-A63C-7EDDF1345A17@strauss-engineering.ch \
    --to=philippe@strauss-engineering.ch \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).