aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbhgv <bhgv.empire@gmail.com>2018-03-10 02:23:07 +0200
committerbhgv <bhgv.empire@gmail.com>2018-03-10 02:23:07 +0200
commit6be8314bcc624a6cd8a3848dd0424fbac74ffc6d (patch)
tree18497d99c9ed034140ebce2194cda28e72a87772
parent6d35aa8bbc5a21ec699dd5cb157741f8766989d3 (diff)
preparing to implement clutter-windows
-rw-r--r--emu/port/devdraw.c22
-rw-r--r--include/memdraw.h2
-rw-r--r--libdraw/alloc.c46
-rw-r--r--libinterp/tk.c2
4 files changed, 72 insertions, 0 deletions
diff --git a/emu/port/devdraw.c b/emu/port/devdraw.c
index 5669428..eda8798 100644
--- a/emu/port/devdraw.c
+++ b/emu/port/devdraw.c
@@ -1260,11 +1260,13 @@ printmesg(char *fmt, uchar *a, int plsprnt)
char *p, *q;
int s;
+#if 1
if(1|| plsprnt==0){
SET(s); SET(q); SET(p);
USED(fmt); USED(a); USED(buf); USED(p); USED(q); USED(s);
return;
}
+#endif
q = buf;
*q++ = *a++;
for(p=fmt; *p; p++){
@@ -1447,6 +1449,26 @@ drawmesg(Client *client, void *av, int n)
dst->flags |= Frepl;
drawrectangle(&dst->clipr, a+6);
continue;
+
+ /* attach to ext win: 'W' dstid[4] */
+ case 'W':
+ printmesg(fmt="L", a, 0);
+ m = 1+4;
+ if(n < m)
+ error(Eshortdraw);
+ dst = drawimage(client, a+1);
+ r = dst->r;
+ //op = drawclientop(client);
+ //memdraw(dst, r, src, p, mask, q, op);
+ //dstflush(dst, r);
+#ifdef clutter
+ if(dst->data && !dst->ext_win)
+ dst->ext_win = attach_clutter_actor(dst->data->bdata,
+ r.min.x, r.min.y,
+ r.max.x, r.max.y);
+printf("clutter new window\n");
+#endif
+ continue;
/* draw: 'd' dstid[4] srcid[4] maskid[4] R[4*4] P[2*4] P[2*4] */
case 'd':
diff --git a/include/memdraw.h b/include/memdraw.h
index 6e6a77d..b8e7499 100644
--- a/include/memdraw.h
+++ b/include/memdraw.h
@@ -53,6 +53,8 @@ struct Memimage
int shift[NChan];
int mask[NChan];
int nbits[NChan];
+
+ void *ext_win;
};
struct Memcmap
diff --git a/libdraw/alloc.c b/libdraw/alloc.c
index 8b55c5e..f29dbe3 100644
--- a/libdraw/alloc.c
+++ b/libdraw/alloc.c
@@ -2,6 +2,52 @@
#include "draw.h"
#include "kernel.h"
+
+void
+attachtowindow(Image *i)
+{
+ uchar *a;
+ char *err;
+// Image *i;
+ Rectangle r;
+ int id;
+ Display *d;
+
+ err = 0;
+
+ if(i == nil){
+ err = "bad image descriptor";
+ Error:
+ if(err)
+ kwerrstr("attachtowindow: %s", err);
+ else
+ kwerrstr("attachtowindow: %r");
+ return;
+ }
+ d = i->display;
+
+ /* flush pending data so we don't get error allocating the image */
+ flushimage(d, 0);
+ a = bufimage(d, 1+4);
+ if(a == 0)
+ goto Error;
+
+ id = i->id;
+ r = i->r;
+
+ a[0] = 'W';
+ BPLONG(a+1, id);
+// BPLONG(a+5, screenid);
+// BPLONG(a+15, r.min.x);
+// BPLONG(a+19, r.min.y);
+// BPLONG(a+23, r.max.x);
+// BPLONG(a+27, r.max.y);
+
+ if(flushimage(d, 0) < 0)
+ goto Error;
+}
+
+
Image*
allocimage(Display *d, Rectangle r, ulong chan, int repl, ulong val)
{
diff --git a/libinterp/tk.c b/libinterp/tk.c
index bf8fc8f..e0ea728 100644
--- a/libinterp/tk.c
+++ b/libinterp/tk.c
@@ -1170,6 +1170,8 @@ tkputwinimage(Tk *tk, Draw_Image *di, int reqid)
if(reqid != -1 && reqid < tkw->reqid)
return "!request out of date";
+ attachtowindow(i);
+
bw2 = 2*tk->borderwidth;
req.min.x = tkw->req.x;
req.min.y = tkw->req.y;