comparison src/video/photon/SDL_ph_mouse.c @ 266:c6abdda2f666

Added QNX cleanups by Mike Gorchak (thanks!)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 18 Jan 2002 18:14:03 +0000
parents e8157fcb3114
children 3d8b6b9f1e18
comparison
equal deleted inserted replaced
265:35d9c8a5aa10 266:c6abdda2f666
83 cursor->ph_cursor->offset1.x = (short)hot_x; 83 cursor->ph_cursor->offset1.x = (short)hot_x;
84 cursor->ph_cursor->offset1.y = (short)hot_y; 84 cursor->ph_cursor->offset1.y = (short)hot_y;
85 cursor->ph_cursor->bytesperline1 = (char)w/8; 85 cursor->ph_cursor->bytesperline1 = (char)w/8;
86 cursor->ph_cursor->color1 = Pg_WHITE; 86 cursor->ph_cursor->color1 = Pg_WHITE;
87 cursor->ph_cursor->size2.x = (short)w; 87 cursor->ph_cursor->size2.x = (short)w;
88 cursor->ph_cursor->size2.y = (short)h; 88 cursor->ph_cursor->size2.y = (short)h;
89 cursor->ph_cursor->offset2.x = (short)hot_x; 89 cursor->ph_cursor->offset2.x = (short)hot_x;
90 cursor->ph_cursor->offset2.y = (short)hot_y; 90 cursor->ph_cursor->offset2.y = (short)hot_y;
91 cursor->ph_cursor->bytesperline2 = (char)w/8; 91 cursor->ph_cursor->bytesperline2 = (char)w/8;
92 cursor->ph_cursor->color2 = Pg_BLACK; 92 cursor->ph_cursor->color2 = Pg_BLACK;
93 93
94 clen = (w/8)*h; 94 clen = (w/8)*h;
95 95
96 /* Copy the mask and the data to different 96 /* Copy the mask and the data to different
97 bitmap planes */ 97 bitmap planes */
98 for ( i=0; i<clen; ++i ) { 98 for ( i=0; i<clen; ++i )
99 cursor->ph_cursor->images[i] = data[i]; 99 {
100 cursor->ph_cursor->images[i+clen] = mask[i]; 100 cursor->ph_cursor->images[i] = data[i];
101 } 101 cursor->ph_cursor->images[i+clen] = mask[i];
102 }
102 103
103 //#bytes following the hdr struct 104 //#bytes following the hdr struct
104 cursor->ph_cursor->hdr.len =sizeof(PhCursorDef_t) + clen*2 - sizeof(PhRegionDataHdr_t); 105 cursor->ph_cursor->hdr.len =sizeof(PhCursorDef_t) + clen*2 - sizeof(PhRegionDataHdr_t);
105 106
106 return (cursor); 107 return (cursor);
107 } 108 }
108 109
109 110
110 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor) 111 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
111 { 112 {
112
113 return(*cursor->ph_cursor); 113 return(*cursor->ph_cursor);
114 } 114 }
115 115
116 116
117 int ph_ShowWMCursor(_THIS, WMcursor *cursor) 117 int ph_ShowWMCursor(_THIS, WMcursor *cursor)
118 { 118 {
119 PtArg_t args[3]; 119 PtArg_t args[3];
120 int nargs = 0; 120 int nargs = 0;
121 short cursor_is_defined = 0; 121 short cursor_is_defined = 0;
122
123
124 122
125 /* Don't do anything if the display is gone */ 123 /* Don't do anything if the display is gone */
126 if ( window == NULL ) { 124 if ( window == NULL ) {
127 return(0); 125 return(0);
128 } 126 }
143 PtSetArg( &args[0], Pt_ARG_CURSOR_TYPE,Ph_CURSOR_NONE, 0); 141 PtSetArg( &args[0], Pt_ARG_CURSOR_TYPE,Ph_CURSOR_NONE, 0);
144 nargs = 1; 142 nargs = 1;
145 cursor_is_defined = 1; 143 cursor_is_defined = 1;
146 } 144 }
147 if (cursor_is_defined) 145 if (cursor_is_defined)
148 { 146 {
149 SDL_Lock_EventThread(); 147 SDL_Lock_EventThread();
150 148
151 if (PtSetResources( window, nargs, args ) < 0 ) 149 if (PtSetResources( window, nargs, args ) < 0 )
152 { 150 {
153 return(0); 151 return(0);
154 } 152 }
161 return(1); 159 return(1);
162 } 160 }
163 161
164 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y) 162 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
165 { 163 {
166 164 SDL_Lock_EventThread();
167 SDL_Lock_EventThread(); 165 PhMoveCursorRel( PhInputGroup(NULL), x, y );
168 PhMoveCursorRel( PhInputGroup(NULL), x, y ); 166 SDL_Unlock_EventThread();
169 SDL_Unlock_EventThread();
170 } 167 }
171 168
172 169
173 void ph_CheckMouseMode(_THIS) 170 void ph_CheckMouseMode(_THIS)
174 { 171 {
175 172 mouse_relative = 1;
176 mouse_relative = 1;
177 } 173 }