summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-19 16:04:24 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-19 16:04:24 +0300
commit36f6b98f6835ed2a93d29f4937ac4d9cfd87a485 (patch)
treebbf3f497e96505214836eaaa1da0364300c7b8f7 /src/ui/documentwidget.c
parent904a84bdbef5143763a6585cf17b35667801fa9f (diff)
Manage mouse cursors at window level
The modal sheets switch mouse cursor to the default arrow.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 449f2f4e..020d624f 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -173,9 +173,6 @@ struct Impl_DocumentWidget {
173 int scrollY; 173 int scrollY;
174 iScrollWidget *scroll; 174 iScrollWidget *scroll;
175 iWidget * menu; 175 iWidget * menu;
176 SDL_Cursor * arrowCursor; /* TODO: cursors belong in Window */
177 SDL_Cursor * beamCursor;
178 SDL_Cursor * handCursor;
179 iVisBuffer * visBuffer; 176 iVisBuffer * visBuffer;
180}; 177};
181 178
@@ -207,9 +204,6 @@ void init_DocumentWidget(iDocumentWidget *d) {
207 d->noHoverWhileScrolling = iFalse; 204 d->noHoverWhileScrolling = iFalse;
208 d->showLinkNumbers = iFalse; 205 d->showLinkNumbers = iFalse;
209 d->visBuffer = new_VisBuffer(); 206 d->visBuffer = new_VisBuffer();
210 d->arrowCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
211 d->beamCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
212 d->handCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
213 init_PtrArray(&d->visibleLinks); 207 init_PtrArray(&d->visibleLinks);
214 init_Click(&d->click, d, SDL_BUTTON_LEFT); 208 init_Click(&d->click, d, SDL_BUTTON_LEFT);
215 addChild_Widget(w, iClob(d->scroll = new_ScrollWidget())); 209 addChild_Widget(w, iClob(d->scroll = new_ScrollWidget()));
@@ -235,9 +229,6 @@ void deinit_DocumentWidget(iDocumentWidget *d) {
235 deinit_PtrArray(&d->visibleLinks); 229 deinit_PtrArray(&d->visibleLinks);
236 delete_String(d->certSubject); 230 delete_String(d->certSubject);
237 delete_String(d->titleUser); 231 delete_String(d->titleUser);
238 SDL_FreeCursor(d->arrowCursor);
239 SDL_FreeCursor(d->beamCursor);
240 SDL_FreeCursor(d->handCursor);
241 deinit_Model(&d->mod); 232 deinit_Model(&d->mod);
242} 233}
243 234
@@ -346,10 +337,11 @@ static void updateHover_DocumentWidget_(iDocumentWidget *d, iInt2 mouse) {
346 } 337 }
347 if (!contains_Widget(constAs_Widget(d), mouse) || 338 if (!contains_Widget(constAs_Widget(d), mouse) ||
348 contains_Widget(constAs_Widget(d->scroll), mouse)) { 339 contains_Widget(constAs_Widget(d->scroll), mouse)) {
349 SDL_SetCursor(d->arrowCursor); 340// setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_ARROW);
350 } 341 }
351 else { 342 else {
352 SDL_SetCursor(d->hoverLink ? d->handCursor : d->beamCursor); 343 setCursor_Window(get_Window(),
344 d->hoverLink ? SDL_SYSTEM_CURSOR_HAND : SDL_SYSTEM_CURSOR_IBEAM);
353 } 345 }
354} 346}
355 347
@@ -1294,7 +1286,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1294 else if (ev->type == SDL_MOUSEMOTION) { 1286 else if (ev->type == SDL_MOUSEMOTION) {
1295 d->noHoverWhileScrolling = iFalse; 1287 d->noHoverWhileScrolling = iFalse;
1296 if (isVisible_Widget(d->menu)) { 1288 if (isVisible_Widget(d->menu)) {
1297 SDL_SetCursor(d->arrowCursor); 1289 setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_ARROW);
1298 } 1290 }
1299 else { 1291 else {
1300 updateHover_DocumentWidget_(d, init_I2(ev->motion.x, ev->motion.y)); 1292 updateHover_DocumentWidget_(d, init_I2(ev->motion.x, ev->motion.y));