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: Re: [Caml-list] Lablgtk3 & Cairo & drawing area
Date: Fri, 15 Jan 2021 17:25:14 +0100	[thread overview]
Message-ID: <A0F3728E-E0E0-47F8-A8AE-817813AFB4AE@strauss-engineering.ch> (raw)
In-Reply-To: <323ED0F3-84EA-443E-A63C-7EDDF1345A17@strauss-engineering.ch>

It seems « Gdk.Cairo.create » is what I was looking for.

> Le 15 janv. 2021 à 14:21, Philippe Strauss <philippe@strauss-engineering.ch> a écrit :
> 
> 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
> 
> 

--
if you lie on the ground in somebody’s arms
you'll probably swallow some of their history
        -- Suzanne Vega


      reply	other threads:[~2021-01-15 16:25 UTC|newest]

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

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=A0F3728E-E0E0-47F8-A8AE-817813AFB4AE@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).