Skip to content
Snippets Groups Projects
Commit f2a9a2c0 authored by Marcus Comstedt's avatar Marcus Comstedt
Browse files

Cursors.

Rev: lib/modules/Protocols.pmod/X.pmod/Requests.pmod:1.18
Rev: lib/modules/Protocols.pmod/X.pmod/Types.pmod:1.21
Rev: lib/modules/Protocols.pmod/X.pmod/Xlib.pmod:1.19
parent 7158621a
No related branches found
No related tags found
No related merge requests found
......@@ -751,6 +751,26 @@ class AllocColor
}
}
class CreateGlyphCursor
{
inherit request;
constant reqType = 94;
int cid;
int sourcefont, maskfont;
int sourcechar, maskchar;
int forered, foregreen, foreblue;
int backred, backgreen, backblue;
string to_string()
{
return build_request(sprintf("%4c%4c%4c%2c%2c%2c%2c%2c%2c%2c%2c",
cid, sourcefont, maskfont, sourcechar,
maskchar, forered, foregreen, foreblue,
backred, backgreen, backblue));
}
}
class QueryExtension
{
inherit request;
......
......@@ -54,6 +54,18 @@ class Font
display->send_request(req);
}
object CreateGlyphCursor(int sourcechar, array(int)|void foreground,
array(int)|void background)
{
return display->CreateGlyphCursor(this_object(), sourcechar, 0, 0,
foreground, background);
}
}
class Cursor
{
inherit XResource;
}
class Visual
......
......@@ -901,4 +901,41 @@ class Display
send_request(req);
return Types.Font(this_object(), req->fid);
}
object CreateGlyphCursor_req(object sourcefont, object maskfont,
int sourcechar, int maskchar,
array(int) foreground, array(int) background)
{
object req = Requests.CreateGlyphCursor();
req->cid = alloc_id();
req->sourcefont = sourcefont->id;
req->maskfont = maskfont->id;
req->sourcechar = sourcechar;
req->maskchar = maskchar;
req->forered = foreground[0];
req->foregreen = foreground[1];
req->foreblue = foreground[2];
req->backred = background[0];
req->backgreen = background[1];
req->backblue = background[2];
return req;
}
object CreateGlyphCursor(object sourcefont, int sourcechar,
object|void maskfont, int|void maskchar,
array(int)|void foreground,
array(int)|void background)
{
if(!maskfont) {
maskfont = sourcefont;
if(!maskchar)
maskchar = sourcechar + 1;
}
object req = CreateGlyphCursor_req(sourcefont, maskfont,
sourcechar, maskchar,
foreground||({0,0,0}),
background||({0xffff,0xffff,0xffff}));
send_request(req);
return Types.Cursor(this_object(), req->cid);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment