xref: /haiku/src/preferences/appearance/SysCursorAPI.cpp (revision 893988af824e65e49e55f517b157db8386e8002b)
1 #include <PortLink.h>
2 #include <ServerProtocol.h>
3 #include <OS.h>
4 #include "SysCursorAPI.h"
5 
6 // TODO R2: tweak the BBitmap and BCursor headers
7 
8 void set_syscursor(cursor_which which, const BCursor *cursor)
9 {
10 /*	port_id server=find_port(SERVER_PORT_NAME);
11 	if(fServerFrom!=B_NAME_NOT_FOUND)
12 	{
13 		PortLink link(server);
14 		link.SetOpCode(AS_SET_SYSCURSOR_BCURSOR);
15 		link.Attach<cursor_which>(which);
16 		link.Attach<int32>(cursor->m_serverToken);
17 		link.Flush();
18 	}
19 */
20 }
21 
22 void set_syscursor(cursor_which which, const BBitmap *bitmap)
23 {
24 /*	port_id server=find_port(SERVER_PORT_NAME);
25 	if(fServerFrom!=B_NAME_NOT_FOUND)
26 	{
27 		PortLink link(server);
28 		link.SetOpCode(AS_SET_SYSCURSOR_BBITMAP);
29 		link.Attach<cursor_which>(which);
30 		link.Attach<int32>(cursor->fToken);
31 		link.Flush();
32 	}
33 */
34 }
35 
36 cursor_which get_syscursor(void)
37 {
38 	port_id server=find_port(SERVER_PORT_NAME);
39 	if(server!=B_NAME_NOT_FOUND)
40 	{
41 		int32 code;
42 		BPrivate::PortLink link(server);
43 
44 		link.StartMessage(AS_GET_SYSCURSOR);
45 		link.GetNextMessage(code);
46 
47 		if(code==SERVER_TRUE)
48 		{
49 			cursor_which which;
50 			link.Read<cursor_which>(&which);
51 			return which;
52 		}
53 	}
54 	return B_CURSOR_INVALID;
55 }
56 
57 void setcursor(cursor_which which)
58 {
59 	port_id server=find_port(SERVER_PORT_NAME);
60 	if(server!=B_NAME_NOT_FOUND)
61 	{
62 		BPrivate::PortLink link(server);
63 		link.StartMessage(AS_SET_CURSOR_SYSTEM);
64 		link.Flush();
65 	}
66 }
67