1 /* 2 * Copyright 2001-2005, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Frans van Nispen (xlr8@tref.nl) 7 * Gabe Yoder (gyoder@stny.rr.com) 8 */ 9 10 /** BCursor describes a view-wide or application-wide cursor. */ 11 12 /** 13 @note: As BeOS only supports 16x16 monochrome cursors, and I would like 14 to see a nice shadowes one, we will need to extend this one. 15 */ 16 17 #include <AppDefs.h> 18 19 #include <Cursor.h> 20 #include <AppServerLink.h> 21 #include <ServerProtocol.h> 22 23 24 const BCursor *B_CURSOR_SYSTEM_DEFAULT; 25 const BCursor *B_CURSOR_I_BEAM; 26 // these are initialized in BApplication::InitData() 27 28 29 BCursor::BCursor(const void *cursorData) 30 { 31 int8 *data = (int8 *)cursorData; 32 m_serverToken = 0; 33 34 if (data == NULL 35 || data[0] != 16 // size 36 || data[1] != 1 // depth 37 || data[2] >= 16 || data[3] >= 16) // hot-spot 38 return; 39 40 // Send data directly to server 41 BPrivate::AppServerLink serverlink; 42 int32 code = SERVER_FALSE; 43 44 serverlink.StartMessage(AS_CREATE_BCURSOR); 45 serverlink.Attach(cursorData, 68); 46 serverlink.FlushWithReply(code); 47 if (code == SERVER_TRUE) 48 serverlink.Read<int32>(&m_serverToken); 49 } 50 51 52 // undefined on BeOS 53 54 BCursor::BCursor(BMessage *data) 55 { 56 m_serverToken = 0; 57 } 58 59 60 BCursor::~BCursor() 61 { 62 // Notify server to deallocate server-side objects for this cursor 63 BPrivate::AppServerLink serverlink; 64 serverlink.StartMessage(AS_DELETE_BCURSOR); 65 serverlink.Attach<int32>(m_serverToken); 66 serverlink.Flush(); 67 } 68 69 70 // not implemented on BeOS 71 72 status_t BCursor::Archive(BMessage *into, bool deep) const 73 { 74 return B_OK; 75 } 76 77 78 // not implemented on BeOS 79 80 BArchivable *BCursor::Instantiate(BMessage *data) 81 { 82 return NULL; 83 } 84 85 86 status_t 87 BCursor::Perform(perform_code d, void *arg) 88 { 89 /* 90 printf("perform %d\n", (int)d); 91 */ 92 return B_OK; 93 } 94 95 96 void BCursor::_ReservedCursor1() {} 97 void BCursor::_ReservedCursor2() {} 98 void BCursor::_ReservedCursor3() {} 99 void BCursor::_ReservedCursor4() {} 100