NetSurf
drawable.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Vincent Sanders <vince@simtec.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * win32 implementation of drawable window showing browser context
22 */
23
24#include <stdbool.h>
25#include <stdint.h>
26
27#include "utils/config.h"
28
29#include <windows.h>
30#include <windowsx.h>
31
32#include "utils/errors.h"
33#include "utils/log.h"
35#include "netsurf/plotters.h"
36#include "netsurf/keypress.h"
37
38#include "windows/windbg.h"
39#include "windows/plot.h"
40#include "windows/window.h"
42#include "windows/drawable.h"
43
44static const wchar_t *windowclassname_drawable = L"nswsdrawablewindow";
45
46
47/**
48 * Handle wheel scroll messages.
49 */
50static LRESULT
51nsws_drawable_wheel(struct gui_window *gw, HWND hwnd, WPARAM wparam)
52{
53 int i, z = GET_WHEEL_DELTA_WPARAM(wparam) / WHEEL_DELTA;
54 int key = LOWORD(wparam);
55 DWORD command;
56 unsigned int newmessage = WM_VSCROLL;
57
58 if (key == MK_SHIFT) {
59 command = (z > 0) ? SB_LINERIGHT : SB_LINELEFT;
60 newmessage = WM_HSCROLL;
61 } else {
62 /* add MK_CONTROL -> zoom */
63 command = (z > 0) ? SB_LINEUP : SB_LINEDOWN;
64 }
65
66 z = (z < 0) ? -1 * z : z;
67
68 for (i = 0; i < z; i++) {
69 SendMessage(hwnd, newmessage, MAKELONG(command, 0), 0);
70 }
71
72 return 0;
73}
74
75
76/**
77 * Handle vertical scroll messages.
78 */
79static LRESULT
80nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
81{
82 int width, height;
83 SCROLLINFO si;
84 int mem;
85
86 NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly);
87
88 if (gw->requestscrolly != 0)
89 return 0;
90
91 si.cbSize = sizeof(si);
92 si.fMask = SIF_ALL;
93 GetScrollInfo(hwnd, SB_VERT, &si);
94 mem = si.nPos;
95
96 switch (LOWORD(wparam)) {
97 case SB_TOP:
98 si.nPos = si.nMin;
99 break;
100
101 case SB_BOTTOM:
102 si.nPos = si.nMax;
103 break;
104
105 case SB_LINEUP:
106 si.nPos -= 30;
107 break;
108
109 case SB_LINEDOWN:
110 si.nPos += 30;
111 break;
112
113 case SB_PAGEUP:
114 si.nPos -= gw->height;
115 break;
116
117 case SB_PAGEDOWN:
118 si.nPos += gw->height;
119 break;
120
121 case SB_THUMBTRACK:
122 si.nPos = si.nTrackPos;
123 break;
124
125 default:
126 break;
127 }
128
129 si.fMask = SIF_POS;
130 if ((gw->bw != NULL) &&
132 &width, &height) == NSERROR_OK)) {
133 si.nPos = min(si.nPos, height - gw->height);
134 }
135
136 si.nPos = max(si.nPos, 0);
137 SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
138 GetScrollInfo(hwnd, SB_VERT, &si);
139 if (si.nPos != mem) {
140 struct rect rect;
141 rect.x0 = rect.x1 = gw->scrollx;
142 rect.y0 = rect.y1 = gw->scrolly + gw->requestscrolly + si.nPos - mem;
144 }
145
146 return 0;
147}
148
149
150/**
151 * Handle horizontal scroll messages.
152 */
153static LRESULT
154nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
155{
156 int width, height;
157 SCROLLINFO si;
158 int mem;
159
160 NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx);
161
162 if (gw->requestscrollx != 0)
163 return 0;
164
165 si.cbSize = sizeof(si);
166 si.fMask = SIF_ALL;
167 GetScrollInfo(hwnd, SB_HORZ, &si);
168 mem = si.nPos;
169
170 switch (LOWORD(wparam)) {
171 case SB_LINELEFT:
172 si.nPos -= 30;
173 break;
174
175 case SB_LINERIGHT:
176 si.nPos += 30;
177 break;
178
179 case SB_PAGELEFT:
180 si.nPos -= gw->width;
181 break;
182
183 case SB_PAGERIGHT:
184 si.nPos += gw->width;
185 break;
186
187 case SB_THUMBTRACK:
188 si.nPos = si.nTrackPos;
189 break;
190
191 default:
192 break;
193 }
194
195 si.fMask = SIF_POS;
196
197 if ((gw->bw != NULL) &&
199 &width, &height) == NSERROR_OK)) {
200 si.nPos = min(si.nPos, width - gw->width);
201 }
202 si.nPos = max(si.nPos, 0);
203 SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
204 GetScrollInfo(hwnd, SB_HORZ, &si);
205 if (si.nPos != mem) {
206 struct rect rect;
207 rect.x0 = rect.x1 = gw->scrollx + gw->requestscrollx + si.nPos - mem;
208 rect.y0 = rect.y1 = gw->scrolly;
210 }
211
212 return 0;
213}
214
215
216/**
217 * Handle resize events.
218 */
219static LRESULT
221{
223 return 0;
224}
225
226/**
227 * Handle unicode character messages.
228 */
229static LRESULT
230nsws_drawable_unichar(struct gui_window *gw, HWND hwnd, WPARAM wparam)
231{
232 uint32_t nskey;
233
234 if (wparam == UNICODE_NOCHAR) {
235 return 1;
236 }
237
238 nskey = wparam;
239 browser_window_key_press(gw->bw, nskey);
240 return 0;
241}
242
243/**
244 * Handle character messages.
245 *
246 * WM_CHAR is generated when WM_KEYDOWN message are passed to
247 * TranslateMessage; wParam is UTF-16. If the codepoint is 4
248 * bytes, there are 2 WM_CHAR message, one with the high
249 * surrogate and one with the low surrogate.
250 */
251static LRESULT
252nsws_drawable_char(struct gui_window *gw, HWND hwnd, WPARAM wparam)
253{
254 uint32_t nskey;
255
256 nskey = wparam;
257
258 const uint32_t utf16_hi_surrogate_start = 0xD800;
259 const uint32_t utf16_lo_surrogate_start = 0xDC00;
260 const uint32_t utf16_surrogate_end = 0xDFFF;
261
262 static uint32_t highSurrogate = 0;
263
264 if ((nskey >= utf16_hi_surrogate_start) &&
265 (nskey < utf16_lo_surrogate_start) ) {
266 highSurrogate = nskey;
267 } else {
268 if ((nskey >= utf16_lo_surrogate_start) &&
269 (nskey <= utf16_surrogate_end)) {
270 uint32_t lowSurrogate = nskey;
271 nskey = (highSurrogate - utf16_hi_surrogate_start) << 10;
272 nskey |= ( lowSurrogate - utf16_lo_surrogate_start );
273 nskey += 0x10000;
274 }
275 highSurrogate = 0;
276
277 browser_window_key_press(gw->bw, nskey);
278 }
279
280 return 0;
281}
282
283/**
284 * Handle keydown messages.
285 */
286static LRESULT
287nsws_drawable_keydown(struct gui_window *gw, HWND hwnd, WPARAM wparam)
288{
289 uint32_t i;
290 bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
291
292 switch(wparam) {
293 case VK_LEFT:
294 i = NS_KEY_LEFT;
295 if (shift)
296 SendMessage(hwnd, WM_HSCROLL,
297 MAKELONG(SB_LINELEFT, 0), 0);
298 break;
299
300 case VK_RIGHT:
301 i = NS_KEY_RIGHT;
302 if (shift)
303 SendMessage(hwnd, WM_HSCROLL,
304 MAKELONG(SB_LINERIGHT, 0), 0);
305 break;
306
307 case VK_UP:
308 i = NS_KEY_UP;
309 if (shift)
310 SendMessage(hwnd, WM_VSCROLL,
311 MAKELONG(SB_LINEUP, 0), 0);
312 break;
313
314 case VK_DOWN:
315 i = NS_KEY_DOWN;
316 if (shift)
317 SendMessage(hwnd, WM_VSCROLL,
318 MAKELONG(SB_LINEDOWN, 0), 0);
319 break;
320
321 case VK_HOME:
323 if (shift)
324 SendMessage(hwnd, WM_HSCROLL,
325 MAKELONG(SB_PAGELEFT, 0), 0);
326 break;
327
328 case VK_END:
329 i = NS_KEY_LINE_END;
330 if (shift)
331 SendMessage(hwnd, WM_HSCROLL,
332 MAKELONG(SB_PAGERIGHT, 0), 0);
333 break;
334
335 case VK_DELETE:
337 break;
338
339 case VK_NEXT:
340 SendMessage(hwnd, WM_VSCROLL, MAKELONG(SB_PAGEDOWN, 0), 0);
341 return 1;
342
343 case VK_PRIOR:
344 SendMessage(hwnd, WM_VSCROLL, MAKELONG(SB_PAGEUP, 0), 0);
345 return 1;
346
347 default:
348 return 1;
349 }
350
352
353 return 0;
354}
355
356
357/**
358 * Handle paint messages.
359 */
360static LRESULT
361nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
362{
363 struct rect clip;
364 PAINTSTRUCT ps;
365 struct redraw_context ctx = {
366 .interactive = true,
367 .background_images = true,
368 .plot = &win_plotters
369 };
370
371 BeginPaint(hwnd, &ps);
372
373 if (gw != NULL) {
374 plot_hdc = ps.hdc;
375
376 clip.x0 = ps.rcPaint.left;
377 clip.y0 = ps.rcPaint.top;
378 clip.x1 = ps.rcPaint.right;
379 clip.y1 = ps.rcPaint.bottom;
380
381 /**
382 * \todo work out why the heck scroll needs scaling
383 */
384
386 -gw->scrollx,
387 -gw->scrolly,
388 &clip,
389 &ctx);
390 }
391
392 EndPaint(hwnd, &ps);
393
394 return 0;
395}
396
397
398/**
399 * Handle mouse button up messages.
400 */
401static LRESULT
403 int x,
404 int y,
407{
408 bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
409 bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
410 bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
411
412 if ((gw == NULL) ||
413 (gw->mouse == NULL) ||
414 (gw->bw == NULL))
415 return 0;
416
417 NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state,
418 press);
419 if ((gw->mouse->state & press) != 0) {
420 gw->mouse->state &= ~press;
421 gw->mouse->state |= click;
422 }
423
424 if (((gw->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
425 gw->mouse->state &= ~BROWSER_MOUSE_MOD_1;
426 if (((gw->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
427 gw->mouse->state &= ~BROWSER_MOUSE_MOD_2;
428 if (((gw->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
429 gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
430
431 if ((gw->mouse->state & click) != 0) {
432 NSLOG(netsurf, INFO,
433 "mouse click bw %p, state 0x%x, x %d, y %d",
434 gw->bw,
435 gw->mouse->state,
436 x + gw->scrollx,
437 y + gw->scrolly);
438
440 gw->mouse->state,
441 x + gw->scrollx,
442 y + gw->scrolly);
443 } else {
445 0,
446 x + gw->scrollx,
447 y + gw->scrolly);
448 }
449
450 gw->mouse->state = 0;
451 return 0;
452}
453
454
455/**
456 * Handle mouse button down messages.
457 */
458static LRESULT
460 int x, int y,
461 browser_mouse_state button)
462{
463 if ((gw == NULL) ||
464 (gw->mouse == NULL) ||
465 (gw->bw == NULL)) {
467 return 0;
468 }
469
470 gw->mouse->state = button;
471 if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
473 if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
475 if ((GetKeyState(VK_MENU) & 0x8000) == 0x8000)
477
478 gw->mouse->pressed_x = x + gw->scrollx;
479 gw->mouse->pressed_y = y + gw->scrolly;
480
481 NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %d, y %d",
482 gw->bw,
483 gw->mouse->state,
484 x + gw->scrollx,
485 y + gw->scrolly);
486
488 gw->mouse->state,
489 x + gw->scrollx,
490 y + gw->scrolly);
491
492 return 0;
493}
494
495
496/**
497 * Handle mouse movement messages.
498 */
499static LRESULT
500nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
501{
502 bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
503 bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
504 bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
505
506 if ((gw == NULL) || (gw->mouse == NULL) || (gw->bw == NULL))
507 return 0;
508
509 /* add scroll offsets */
510 x = x + gw->scrollx;
511 y = y + gw->scrolly;
512
513 /* if mouse button held down and pointer moved more than
514 * minimum distance drag is happening */
515 if (((gw->mouse->state & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2)) != 0) &&
516 (abs(x - gw->mouse->pressed_x) >= 5) &&
517 (abs(y - gw->mouse->pressed_y) >= 5)) {
518
519 NSLOG(netsurf, INFO, "Drag start state 0x%x",
520 gw->mouse->state);
521
522 if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
524 gw->mouse->pressed_x,
525 gw->mouse->pressed_y);
526 gw->mouse->state &= ~BROWSER_MOUSE_PRESS_1;
529 }
530 else if ((gw->mouse->state & BROWSER_MOUSE_PRESS_2) != 0) {
532 gw->mouse->pressed_x,
533 gw->mouse->pressed_y);
534 gw->mouse->state &= ~BROWSER_MOUSE_PRESS_2;
537 }
538 }
539
540 if (((gw->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
541 gw->mouse->state &= ~BROWSER_MOUSE_MOD_1;
542 if (((gw->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
543 gw->mouse->state &= ~BROWSER_MOUSE_MOD_2;
544 if (((gw->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
545 gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
546
547
548 browser_window_mouse_track(gw->bw, gw->mouse->state, x, y);
549
550 return 0;
551}
552
553
554/**
555 * Called when activity occours within the drawable window.
556 */
557static LRESULT CALLBACK
559 UINT msg,
560 WPARAM wparam,
561 LPARAM lparam)
562{
563 struct gui_window *gw;
564
565 LOG_WIN_MSG(hwnd, msg, wparam, lparam);
566
567 gw = nsws_get_gui_window(hwnd);
568 if (gw == NULL) {
569 NSLOG(netsurf, INFO,
570 "Unable to find gui window structure for hwnd %p", hwnd);
571 return DefWindowProc(hwnd, msg, wparam, lparam);
572 }
573
574 switch(msg) {
575
576 case WM_MOUSEMOVE:
577 return nsws_drawable_mousemove(gw,
578 GET_X_LPARAM(lparam),
579 GET_Y_LPARAM(lparam));
580
581 case WM_LBUTTONDOWN:
583 GET_X_LPARAM(lparam),
584 GET_Y_LPARAM(lparam),
586 SetFocus(hwnd);
588 return 0;
589
590 case WM_RBUTTONDOWN:
592 GET_X_LPARAM(lparam),
593 GET_Y_LPARAM(lparam),
595 SetFocus(hwnd);
596 return 0;
597
598 case WM_LBUTTONUP:
599 return nsws_drawable_mouseup(gw,
600 GET_X_LPARAM(lparam),
601 GET_Y_LPARAM(lparam),
604
605 case WM_RBUTTONUP:
606 return nsws_drawable_mouseup(gw,
607 GET_X_LPARAM(lparam),
608 GET_Y_LPARAM(lparam),
611
612 case WM_ERASEBKGND: /* ignore as drawable window is redrawn on paint */
613 return 0;
614
615 case WM_PAINT: /* redraw the exposed part of the window */
616 return nsws_drawable_paint(gw, hwnd);
617
618 case WM_KEYDOWN:
619 if (nsws_drawable_keydown(gw, hwnd, wparam) == 0) {
620 return 0;
621 }
622 break;
623
624 case WM_CHAR:
625 return nsws_drawable_char(gw, hwnd, wparam);
626
627 case WM_UNICHAR:
628 return nsws_drawable_unichar(gw, hwnd, wparam);
629
630 case WM_SIZE:
631 return nsws_drawable_resize(gw);
632
633 case WM_HSCROLL:
634 return nsws_drawable_hscroll(gw, hwnd, wparam);
635
636 case WM_VSCROLL:
637 return nsws_drawable_vscroll(gw, hwnd, wparam);
638
639 case WM_MOUSEWHEEL:
640 return nsws_drawable_wheel(gw, hwnd, wparam);
641
642 case WM_PASTE:
644 return 0;
645
646 case WM_COPY:
648 return 0;
649
650 case WM_CUT:
652 return 0;
653
654 case WM_CLEAR:
655 /**
656 * \todo win32 clear operation deletes the contents of
657 * the selection but ns clear selection only
658 * removes the highlight.
659 */
661 return 0;
662
663
664
665 }
666 return DefWindowProc(hwnd, msg, wparam, lparam);
667}
668
669
670/**
671 * Create a drawable window.
672 */
673HWND
674nsws_window_create_drawable(HINSTANCE hinstance,
675 HWND hparent,
676 struct gui_window *gw)
677{
678 HWND hwnd;
679 hwnd = CreateWindowExW(0,
681 NULL,
682 WS_VISIBLE | WS_CHILD,
683 0, 0,
684 0, 0,
685 hparent,
686 NULL,
687 hinstance,
688 NULL);
689
690 if (hwnd == NULL) {
691 win_perror("WindowCreateDrawable");
692 NSLOG(netsurf, INFO, "Window creation failed");
693 return NULL;
694 }
695
696 /* set the gui window associated with this toolbar */
697 SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
698
699 return hwnd;
700}
701
702
703/**
704 * Create the drawable window class.
705 */
707nsws_create_drawable_class(HINSTANCE hinstance) {
708 nserror ret = NSERROR_OK;
709 WNDCLASSEXW w;
710
711 /* drawable area */
712 w.cbSize = sizeof(WNDCLASSEX);
713 w.style = 0;
715 w.cbClsExtra = 0;
716 w.cbWndExtra = 0;
717 w.hInstance = hinstance;
718 w.hIcon = NULL;
719 w.hCursor = NULL;
720 w.hbrBackground = (HBRUSH)(COLOR_MENU + 1);
721 w.lpszMenuName = NULL;
722 w.lpszClassName = windowclassname_drawable;
723 w.hIconSm = NULL;
724
725 if (RegisterClassExW(&w) == 0) {
726 win_perror("DrawableClass");
728 }
729
730 return ret;
731}
Browser window creation and manipulation interface.
nserror browser_window_schedule_reformat(struct browser_window *bw)
Reformat the browser window contents in a safe context.
bool browser_window_redraw(struct browser_window *bw, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw an area of a window.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
nserror browser_window_get_extents(struct browser_window *bw, bool scaled, int *width, int *height)
Get a browser window's content extents.
void browser_window_mouse_track(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle non-click mouse action in a browser window.
static LRESULT nsws_drawable_unichar(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle unicode character messages.
Definition: drawable.c:230
static LRESULT CALLBACK nsws_window_drawable_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Called when activity occours within the drawable window.
Definition: drawable.c:558
static LRESULT nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle vertical scroll messages.
Definition: drawable.c:80
static const wchar_t * windowclassname_drawable
Definition: drawable.c:44
nserror nsws_create_drawable_class(HINSTANCE hinstance)
Create the drawable window class.
Definition: drawable.c:707
static LRESULT nsws_drawable_resize(struct gui_window *gw)
Handle resize events.
Definition: drawable.c:220
static LRESULT nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
Handle paint messages.
Definition: drawable.c:361
static LRESULT nsws_drawable_mousedown(struct gui_window *gw, int x, int y, browser_mouse_state button)
Handle mouse button down messages.
Definition: drawable.c:459
static LRESULT nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle horizontal scroll messages.
Definition: drawable.c:154
HWND nsws_window_create_drawable(HINSTANCE hinstance, HWND hparent, struct gui_window *gw)
Create a drawable window.
Definition: drawable.c:674
static LRESULT nsws_drawable_char(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle character messages.
Definition: drawable.c:252
static LRESULT nsws_drawable_wheel(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle wheel scroll messages.
Definition: drawable.c:51
static LRESULT nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
Handle mouse movement messages.
Definition: drawable.c:500
static LRESULT nsws_drawable_mouseup(struct gui_window *gw, int x, int y, browser_mouse_state press, browser_mouse_state click)
Handle mouse button up messages.
Definition: drawable.c:402
static LRESULT nsws_drawable_keydown(struct gui_window *gw, HWND hwnd, WPARAM wparam)
Handle keydown messages.
Definition: drawable.c:287
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_INIT_FAILED
Initialisation failed.
Definition: errors.h:38
@ NSERROR_OK
No error.
Definition: errors.h:30
nserror nsw32_local_history_hide(void)
hide the local history window.
Interface to win32 local history manager using nsw32 core window.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
@ BROWSER_MOUSE_PRESS_1
button 1 pressed
Definition: mouse.h:50
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
Definition: mouse.h:57
@ BROWSER_MOUSE_PRESS_2
button 2 pressed
Definition: mouse.h:52
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Definition: mouse.h:55
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
Definition: mouse.h:80
@ BROWSER_MOUSE_MOD_3
3rd modifier key pressed (eg.
Definition: mouse.h:82
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
Definition: mouse.h:78
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
Definition: mouse.h:65
@ BROWSER_MOUSE_HOLDING_2
during button 2 drag
Definition: mouse.h:75
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
Definition: mouse.h:73
@ BROWSER_MOUSE_DRAG_ON
a drag operation was started and a mouse button is still pressed
Definition: mouse.h:70
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Definition: mouse.h:67
Target independent plotting interface.
Interface to key press operations.
@ NS_KEY_LINE_START
Definition: keypress.h:57
@ NS_KEY_RIGHT
Definition: keypress.h:51
@ NS_KEY_LEFT
Definition: keypress.h:50
@ NS_KEY_PASTE
Definition: keypress.h:43
@ NS_KEY_COPY_SELECTION
Definition: keypress.h:33
@ NS_KEY_DOWN
Definition: keypress.h:53
@ NS_KEY_CUT_SELECTION
Definition: keypress.h:44
@ NS_KEY_LINE_END
Definition: keypress.h:58
@ NS_KEY_DELETE_RIGHT
Definition: keypress.h:55
@ NS_KEY_CLEAR_SELECTION
Definition: keypress.h:45
@ NS_KEY_UP
Definition: keypress.h:52
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
Definition: textinput.c:107
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
int width
Definition: gui.c:160
int height
Definition: gui.c:161
first entry in window list
Definition: gui.c:297
int state
Definition: window.cpp:73
int height
height of drawing area
Definition: browser.h:34
int width
width of window
Definition: browser.h:34
int requestscrolly
scolling requested.
Definition: window.h:71
int requestscrollx
Definition: window.h:71
int scrollx
current scroll location
Definition: gui.c:306
int pressed_y
Definition: window.cpp:72
int pressed_x
Definition: window.cpp:71
struct gui_window::@32 mouse
int scrolly
current scroll location
Definition: gui.c:307
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
Definition: gui.c:315
Rectangle coordinates.
Definition: types.h:40
int x0
Definition: types.h:41
int y0
Top left.
Definition: types.h:41
int x1
Definition: types.h:42
int y1
Bottom right.
Definition: types.h:42
Redraw context.
Definition: plotters.h:51
bool interactive
Redraw to show interactive features.
Definition: plotters.h:59
#define min(x, y)
Definition: utils.h:46
#define max(x, y)
Definition: utils.h:50
void win_perror(const char *lpszFunction)
Definition: windbg.c:633
#define LOG_WIN_MSG(h, m, w, l)
log windows message
Definition: windbg.h:32
HDC plot_hdc
Definition: plot.c:44
const struct plotter_table win_plotters
win32 API plot operation table
Definition: plot.c:1040
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357
struct gui_window * nsws_get_gui_window(HWND hwnd)
Obtain gui window structure from window handle.
Definition: window.c:1925
nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a win32 browser window.
Definition: window.c:1983