caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Lablgtk3 & Cairo & drawing area
@ 2021-01-15 13:21 Philippe Strauss
  2021-01-15 16:25 ` Philippe Strauss
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Strauss @ 2021-01-15 13:21 UTC (permalink / raw)
  To: caml-list

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Lablgtk3 & Cairo & drawing area
  2021-01-15 13:21 [Caml-list] Lablgtk3 & Cairo & drawing area Philippe Strauss
@ 2021-01-15 16:25 ` Philippe Strauss
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Strauss @ 2021-01-15 16:25 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-15 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 13:21 [Caml-list] Lablgtk3 & Cairo & drawing area Philippe Strauss
2021-01-15 16:25 ` Philippe Strauss

caml-list - the Caml user's mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/caml-list
	git clone --mirror https://inbox.ocaml.org/caml-list

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 caml-list caml-list/ http://inbox.vuxu.org/caml-list \
		caml-list@inria.fr
	public-inbox-index caml-list

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.caml-list


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git