2011-04-04 02:01:37 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Vincent Sanders <vince@simtec.co.uk>
|
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* win32 implementation of drawable window showing browser context
|
|
|
|
*/
|
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
#include <stdbool.h>
|
2016-05-30 23:21:09 +03:00
|
|
|
#include <stdint.h>
|
2011-04-04 02:01:37 +04:00
|
|
|
|
2012-08-11 01:22:59 +04:00
|
|
|
#include "utils/config.h"
|
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
#include <windows.h>
|
|
|
|
#include <windowsx.h>
|
|
|
|
|
|
|
|
#include "utils/errors.h"
|
|
|
|
#include "utils/log.h"
|
2016-05-30 23:21:09 +03:00
|
|
|
#include "netsurf/browser_window.h"
|
|
|
|
#include "netsurf/plotters.h"
|
2016-07-01 16:27:04 +03:00
|
|
|
#include "netsurf/keypress.h"
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
#include "windows/windbg.h"
|
|
|
|
#include "windows/plot.h"
|
|
|
|
#include "windows/window.h"
|
2017-06-02 01:57:09 +03:00
|
|
|
#include "windows/local_history.h"
|
2011-04-04 02:01:37 +04:00
|
|
|
#include "windows/drawable.h"
|
|
|
|
|
2019-05-10 01:27:59 +03:00
|
|
|
static const wchar_t *windowclassname_drawable = L"nswsdrawablewindow";
|
2011-04-04 02:01:37 +04:00
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Handle wheel scroll messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_wheel(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
|
|
|
{
|
|
|
|
int i, z = GET_WHEEL_DELTA_WPARAM(wparam) / WHEEL_DELTA;
|
|
|
|
int key = LOWORD(wparam);
|
|
|
|
DWORD command;
|
|
|
|
unsigned int newmessage = WM_VSCROLL;
|
|
|
|
|
|
|
|
if (key == MK_SHIFT) {
|
|
|
|
command = (z > 0) ? SB_LINERIGHT : SB_LINELEFT;
|
|
|
|
newmessage = WM_HSCROLL;
|
|
|
|
} else {
|
|
|
|
/* add MK_CONTROL -> zoom */
|
|
|
|
command = (z > 0) ? SB_LINEUP : SB_LINEDOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
z = (z < 0) ? -1 * z : z;
|
|
|
|
|
|
|
|
for (i = 0; i < z; i++) {
|
|
|
|
SendMessage(hwnd, newmessage, MAKELONG(command, 0), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Handle vertical scroll messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
|
|
|
{
|
2014-05-15 17:33:17 +04:00
|
|
|
int width, height;
|
2011-04-04 02:01:37 +04:00
|
|
|
SCROLLINFO si;
|
|
|
|
int mem;
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
if (gw->requestscrolly != 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_ALL;
|
|
|
|
GetScrollInfo(hwnd, SB_VERT, &si);
|
|
|
|
mem = si.nPos;
|
|
|
|
|
|
|
|
switch (LOWORD(wparam)) {
|
|
|
|
case SB_TOP:
|
|
|
|
si.nPos = si.nMin;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_BOTTOM:
|
|
|
|
si.nPos = si.nMax;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_LINEUP:
|
|
|
|
si.nPos -= 30;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_LINEDOWN:
|
|
|
|
si.nPos += 30;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_PAGEUP:
|
|
|
|
si.nPos -= gw->height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_PAGEDOWN:
|
|
|
|
si.nPos += gw->height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_THUMBTRACK:
|
|
|
|
si.nPos = si.nTrackPos;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
si.fMask = SIF_POS;
|
2014-05-15 17:33:17 +04:00
|
|
|
if ((gw->bw != NULL) &&
|
2017-02-17 23:44:37 +03:00
|
|
|
(browser_window_get_extents(gw->bw, true,
|
|
|
|
&width, &height) == NSERROR_OK)) {
|
2014-05-15 17:33:17 +04:00
|
|
|
si.nPos = min(si.nPos, height - gw->height);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
si.nPos = max(si.nPos, 0);
|
|
|
|
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
|
|
|
|
GetScrollInfo(hwnd, SB_VERT, &si);
|
|
|
|
if (si.nPos != mem) {
|
2017-04-27 00:27:49 +03:00
|
|
|
struct rect rect;
|
|
|
|
rect.x0 = rect.x1 = gw->scrollx;
|
|
|
|
rect.y0 = rect.y1 = gw->scrolly + gw->requestscrolly + si.nPos - mem;
|
|
|
|
win32_window_set_scroll(gw, &rect);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle horizontal scroll messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
|
|
|
{
|
2014-05-15 17:33:17 +04:00
|
|
|
int width, height;
|
2011-04-04 02:01:37 +04:00
|
|
|
SCROLLINFO si;
|
|
|
|
int mem;
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
if (gw->requestscrollx != 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
si.cbSize = sizeof(si);
|
|
|
|
si.fMask = SIF_ALL;
|
|
|
|
GetScrollInfo(hwnd, SB_HORZ, &si);
|
|
|
|
mem = si.nPos;
|
|
|
|
|
|
|
|
switch (LOWORD(wparam)) {
|
|
|
|
case SB_LINELEFT:
|
|
|
|
si.nPos -= 30;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_LINERIGHT:
|
|
|
|
si.nPos += 30;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_PAGELEFT:
|
|
|
|
si.nPos -= gw->width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_PAGERIGHT:
|
|
|
|
si.nPos += gw->width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SB_THUMBTRACK:
|
|
|
|
si.nPos = si.nTrackPos;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
|
2014-05-15 17:33:17 +04:00
|
|
|
if ((gw->bw != NULL) &&
|
2017-02-17 23:44:37 +03:00
|
|
|
(browser_window_get_extents(gw->bw, true,
|
|
|
|
&width, &height) == NSERROR_OK)) {
|
2014-05-15 17:33:17 +04:00
|
|
|
si.nPos = min(si.nPos, width - gw->width);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
si.nPos = max(si.nPos, 0);
|
|
|
|
SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
|
|
|
|
GetScrollInfo(hwnd, SB_HORZ, &si);
|
|
|
|
if (si.nPos != mem) {
|
2017-04-27 00:27:49 +03:00
|
|
|
struct rect rect;
|
|
|
|
rect.x0 = rect.x1 = gw->scrollx + gw->requestscrollx + si.nPos - mem;
|
|
|
|
rect.y0 = rect.y1 = gw->scrolly;
|
|
|
|
win32_window_set_scroll(gw, &rect);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Handle resize events.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_resize(struct gui_window *gw)
|
|
|
|
{
|
2016-03-17 00:07:14 +03:00
|
|
|
browser_window_schedule_reformat(gw->bw);
|
2011-04-04 02:01:37 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-05-10 01:27:59 +03:00
|
|
|
/**
|
|
|
|
* Handle unicode character messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_unichar(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
|
|
|
{
|
|
|
|
uint32_t nskey;
|
|
|
|
|
|
|
|
if (wparam == UNICODE_NOCHAR) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nskey = wparam;
|
|
|
|
browser_window_key_press(gw->bw, nskey);
|
|
|
|
return 0;
|
|
|
|
}
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
2019-05-10 01:27:59 +03:00
|
|
|
* Handle character messages.
|
|
|
|
*
|
|
|
|
* WM_CHAR is generated when WM_KEYDOWN message are passed to
|
|
|
|
* TranslateMessage; wParam is UTF-16. If the codepoint is 4
|
|
|
|
* bytes, there are 2 WM_CHAR message, one with the high
|
|
|
|
* surrogate and one with the low surrogate.
|
2011-04-04 02:01:37 +04:00
|
|
|
*/
|
|
|
|
static LRESULT
|
2019-05-10 01:27:59 +03:00
|
|
|
nsws_drawable_char(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
2011-04-04 02:01:37 +04:00
|
|
|
{
|
2019-05-10 01:27:59 +03:00
|
|
|
uint32_t nskey;
|
|
|
|
|
|
|
|
nskey = wparam;
|
|
|
|
|
|
|
|
const uint32_t utf16_hi_surrogate_start = 0xD800;
|
|
|
|
const uint32_t utf16_lo_surrogate_start = 0xDC00;
|
|
|
|
const uint32_t utf16_surrogate_end = 0xDFFF;
|
|
|
|
|
|
|
|
static uint32_t highSurrogate = 0;
|
|
|
|
|
|
|
|
if ((nskey >= utf16_hi_surrogate_start) &&
|
|
|
|
(nskey < utf16_lo_surrogate_start) ) {
|
|
|
|
highSurrogate = nskey;
|
|
|
|
} else {
|
|
|
|
if ((nskey >= utf16_lo_surrogate_start) &&
|
|
|
|
(nskey <= utf16_surrogate_end)) {
|
|
|
|
uint32_t lowSurrogate = nskey;
|
|
|
|
nskey = (highSurrogate - utf16_hi_surrogate_start) << 10;
|
|
|
|
nskey |= ( lowSurrogate - utf16_lo_surrogate_start );
|
|
|
|
nskey += 0x10000;
|
|
|
|
}
|
|
|
|
highSurrogate = 0;
|
|
|
|
|
|
|
|
browser_window_key_press(gw->bw, nskey);
|
|
|
|
}
|
2011-04-04 02:01:37 +04:00
|
|
|
|
2019-05-10 01:27:59 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle keydown messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_keydown(struct gui_window *gw, HWND hwnd, WPARAM wparam)
|
|
|
|
{
|
2011-04-04 02:01:37 +04:00
|
|
|
uint32_t i;
|
|
|
|
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
|
|
|
|
|
|
|
|
switch(wparam) {
|
|
|
|
case VK_LEFT:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_LEFT;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_HSCROLL,
|
|
|
|
MAKELONG(SB_LINELEFT, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_RIGHT:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_RIGHT;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_HSCROLL,
|
|
|
|
MAKELONG(SB_LINERIGHT, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_UP:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_UP;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_VSCROLL,
|
|
|
|
MAKELONG(SB_LINEUP, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DOWN:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_DOWN;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_VSCROLL,
|
|
|
|
MAKELONG(SB_LINEDOWN, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_HOME:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_LINE_START;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_HSCROLL,
|
|
|
|
MAKELONG(SB_PAGELEFT, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_END:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_LINE_END;
|
2011-04-04 02:01:37 +04:00
|
|
|
if (shift)
|
|
|
|
SendMessage(hwnd, WM_HSCROLL,
|
|
|
|
MAKELONG(SB_PAGERIGHT, 0), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DELETE:
|
2015-03-27 12:36:19 +03:00
|
|
|
i = NS_KEY_DELETE_RIGHT;
|
2011-04-04 02:01:37 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_NEXT:
|
2019-05-10 01:27:59 +03:00
|
|
|
SendMessage(hwnd, WM_VSCROLL, MAKELONG(SB_PAGEDOWN, 0), 0);
|
|
|
|
return 1;
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
case VK_PRIOR:
|
2019-05-10 01:27:59 +03:00
|
|
|
SendMessage(hwnd, WM_VSCROLL, MAKELONG(SB_PAGEUP, 0), 0);
|
|
|
|
return 1;
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
default:
|
2019-05-10 01:27:59 +03:00
|
|
|
return 1;
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
2019-05-10 01:27:59 +03:00
|
|
|
browser_window_key_press(gw->bw, i);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle paint messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
|
|
|
|
{
|
|
|
|
struct rect clip;
|
|
|
|
PAINTSTRUCT ps;
|
2011-06-30 19:48:07 +04:00
|
|
|
struct redraw_context ctx = {
|
|
|
|
.interactive = true,
|
2011-12-24 02:39:25 +04:00
|
|
|
.background_images = true,
|
2011-06-30 19:48:07 +04:00
|
|
|
.plot = &win_plotters
|
|
|
|
};
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
BeginPaint(hwnd, &ps);
|
|
|
|
|
|
|
|
if (gw != NULL) {
|
|
|
|
plot_hdc = ps.hdc;
|
|
|
|
|
|
|
|
clip.x0 = ps.rcPaint.left;
|
|
|
|
clip.y0 = ps.rcPaint.top;
|
|
|
|
clip.x1 = ps.rcPaint.right;
|
|
|
|
clip.y1 = ps.rcPaint.bottom;
|
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
/**
|
|
|
|
* \todo work out why the heck scroll needs scaling
|
|
|
|
*/
|
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
browser_window_redraw(gw->bw,
|
2019-08-04 13:23:35 +03:00
|
|
|
-gw->scrollx,
|
|
|
|
-gw->scrolly,
|
2019-08-03 12:49:07 +03:00
|
|
|
&clip,
|
|
|
|
&ctx);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
EndPaint(hwnd, &ps);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle mouse button up messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_mouseup(struct gui_window *gw,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
browser_mouse_state press,
|
|
|
|
browser_mouse_state click)
|
|
|
|
{
|
|
|
|
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
|
|
|
|
bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
|
|
|
|
bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
|
|
|
|
|
|
|
|
if ((gw == NULL) ||
|
|
|
|
(gw->mouse == NULL) ||
|
|
|
|
(gw->bw == NULL))
|
|
|
|
return 0;
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state,
|
|
|
|
press);
|
2011-04-04 02:01:37 +04:00
|
|
|
if ((gw->mouse->state & press) != 0) {
|
|
|
|
gw->mouse->state &= ~press;
|
|
|
|
gw->mouse->state |= click;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_1;
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_2;
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
|
|
|
|
|
|
|
|
if ((gw->mouse->state & click) != 0) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
2019-08-03 12:49:07 +03:00
|
|
|
"mouse click bw %p, state 0x%x, x %d, y %d",
|
|
|
|
gw->bw,
|
|
|
|
gw->mouse->state,
|
|
|
|
x + gw->scrollx,
|
|
|
|
y + gw->scrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
browser_window_mouse_click(gw->bw,
|
|
|
|
gw->mouse->state,
|
2019-08-03 12:49:07 +03:00
|
|
|
x + gw->scrollx,
|
|
|
|
y + gw->scrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
} else {
|
2011-06-27 21:45:17 +04:00
|
|
|
browser_window_mouse_track(gw->bw,
|
|
|
|
0,
|
2019-08-03 12:49:07 +03:00
|
|
|
x + gw->scrollx,
|
|
|
|
y + gw->scrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
gw->mouse->state = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle mouse button down messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_mousedown(struct gui_window *gw,
|
|
|
|
int x, int y,
|
|
|
|
browser_mouse_state button)
|
|
|
|
{
|
|
|
|
if ((gw == NULL) ||
|
|
|
|
(gw->mouse == NULL) ||
|
|
|
|
(gw->bw == NULL)) {
|
2017-06-02 01:57:09 +03:00
|
|
|
nsw32_local_history_hide();
|
2011-04-04 02:01:37 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gw->mouse->state = button;
|
|
|
|
if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
|
|
|
|
gw->mouse->state |= BROWSER_MOUSE_MOD_1;
|
|
|
|
if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
|
|
|
|
gw->mouse->state |= BROWSER_MOUSE_MOD_2;
|
|
|
|
if ((GetKeyState(VK_MENU) & 0x8000) == 0x8000)
|
|
|
|
gw->mouse->state |= BROWSER_MOUSE_MOD_3;
|
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
gw->mouse->pressed_x = x + gw->scrollx;
|
|
|
|
gw->mouse->pressed_y = y + gw->scrolly;
|
2011-04-04 02:01:37 +04:00
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %d, y %d",
|
|
|
|
gw->bw,
|
|
|
|
gw->mouse->state,
|
|
|
|
x + gw->scrollx,
|
|
|
|
y + gw->scrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
browser_window_mouse_click(gw->bw,
|
|
|
|
gw->mouse->state,
|
|
|
|
x + gw->scrollx,
|
|
|
|
y + gw->scrolly);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Handle mouse movement messages.
|
|
|
|
*/
|
|
|
|
static LRESULT
|
|
|
|
nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
|
|
|
|
{
|
|
|
|
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
|
|
|
|
bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
|
|
|
|
bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
|
|
|
|
|
|
|
|
if ((gw == NULL) || (gw->mouse == NULL) || (gw->bw == NULL))
|
|
|
|
return 0;
|
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
/* add scroll offsets */
|
|
|
|
x = x + gw->scrollx;
|
|
|
|
y = y + gw->scrolly;
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
/* if mouse button held down and pointer moved more than
|
|
|
|
* minimum distance drag is happening */
|
|
|
|
if (((gw->mouse->state & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2)) != 0) &&
|
|
|
|
(abs(x - gw->mouse->pressed_x) >= 5) &&
|
|
|
|
(abs(y - gw->mouse->pressed_y) >= 5)) {
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Drag start state 0x%x",
|
|
|
|
gw->mouse->state);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
|
|
|
|
browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1,
|
|
|
|
gw->mouse->pressed_x,
|
|
|
|
gw->mouse->pressed_y);
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_PRESS_1;
|
|
|
|
gw->mouse->state |= BROWSER_MOUSE_HOLDING_1 |
|
|
|
|
BROWSER_MOUSE_DRAG_ON;
|
|
|
|
}
|
|
|
|
else if ((gw->mouse->state & BROWSER_MOUSE_PRESS_2) != 0) {
|
|
|
|
browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_2,
|
|
|
|
gw->mouse->pressed_x,
|
|
|
|
gw->mouse->pressed_y);
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_PRESS_2;
|
|
|
|
gw->mouse->state |= BROWSER_MOUSE_HOLDING_2 |
|
|
|
|
BROWSER_MOUSE_DRAG_ON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_1;
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_2;
|
|
|
|
if (((gw->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
|
|
|
|
gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
|
|
|
|
|
|
|
|
|
2019-08-03 12:49:07 +03:00
|
|
|
browser_window_mouse_track(gw->bw, gw->mouse->state, x, y);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Called when activity occours within the drawable window.
|
|
|
|
*/
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
nsws_window_drawable_event_callback(HWND hwnd,
|
|
|
|
UINT msg,
|
|
|
|
WPARAM wparam,
|
|
|
|
LPARAM lparam)
|
|
|
|
{
|
|
|
|
struct gui_window *gw;
|
|
|
|
|
|
|
|
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
|
|
|
|
|
|
|
|
gw = nsws_get_gui_window(hwnd);
|
|
|
|
if (gw == NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Unable to find gui window structure for hwnd %p", hwnd);
|
2011-04-04 02:01:37 +04:00
|
|
|
return DefWindowProc(hwnd, msg, wparam, lparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(msg) {
|
|
|
|
|
|
|
|
case WM_MOUSEMOVE:
|
|
|
|
return nsws_drawable_mousemove(gw,
|
|
|
|
GET_X_LPARAM(lparam),
|
|
|
|
GET_Y_LPARAM(lparam));
|
|
|
|
|
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
nsws_drawable_mousedown(gw,
|
|
|
|
GET_X_LPARAM(lparam),
|
|
|
|
GET_Y_LPARAM(lparam),
|
|
|
|
BROWSER_MOUSE_PRESS_1);
|
|
|
|
SetFocus(hwnd);
|
2017-06-02 01:57:09 +03:00
|
|
|
nsw32_local_history_hide();
|
2011-04-04 02:01:37 +04:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_RBUTTONDOWN:
|
|
|
|
nsws_drawable_mousedown(gw,
|
|
|
|
GET_X_LPARAM(lparam),
|
|
|
|
GET_Y_LPARAM(lparam),
|
|
|
|
BROWSER_MOUSE_PRESS_2);
|
|
|
|
SetFocus(hwnd);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_LBUTTONUP:
|
|
|
|
return nsws_drawable_mouseup(gw,
|
|
|
|
GET_X_LPARAM(lparam),
|
|
|
|
GET_Y_LPARAM(lparam),
|
|
|
|
BROWSER_MOUSE_PRESS_1,
|
|
|
|
BROWSER_MOUSE_CLICK_1);
|
|
|
|
|
|
|
|
case WM_RBUTTONUP:
|
|
|
|
return nsws_drawable_mouseup(gw,
|
|
|
|
GET_X_LPARAM(lparam),
|
|
|
|
GET_Y_LPARAM(lparam),
|
|
|
|
BROWSER_MOUSE_PRESS_2,
|
|
|
|
BROWSER_MOUSE_CLICK_2);
|
|
|
|
|
|
|
|
case WM_ERASEBKGND: /* ignore as drawable window is redrawn on paint */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_PAINT: /* redraw the exposed part of the window */
|
|
|
|
return nsws_drawable_paint(gw, hwnd);
|
|
|
|
|
|
|
|
case WM_KEYDOWN:
|
2019-05-10 01:27:59 +03:00
|
|
|
if (nsws_drawable_keydown(gw, hwnd, wparam) == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_CHAR:
|
|
|
|
return nsws_drawable_char(gw, hwnd, wparam);
|
|
|
|
|
|
|
|
case WM_UNICHAR:
|
|
|
|
return nsws_drawable_unichar(gw, hwnd, wparam);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
case WM_SIZE:
|
|
|
|
return nsws_drawable_resize(gw);
|
|
|
|
|
|
|
|
case WM_HSCROLL:
|
|
|
|
return nsws_drawable_hscroll(gw, hwnd, wparam);
|
|
|
|
|
|
|
|
case WM_VSCROLL:
|
|
|
|
return nsws_drawable_vscroll(gw, hwnd, wparam);
|
|
|
|
|
|
|
|
case WM_MOUSEWHEEL:
|
|
|
|
return nsws_drawable_wheel(gw, hwnd, wparam);
|
|
|
|
|
2019-05-10 01:11:05 +03:00
|
|
|
case WM_PASTE:
|
|
|
|
browser_window_key_press(gw->bw, NS_KEY_PASTE);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_COPY:
|
|
|
|
browser_window_key_press(gw->bw, NS_KEY_COPY_SELECTION);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_CUT:
|
|
|
|
browser_window_key_press(gw->bw, NS_KEY_CUT_SELECTION);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_CLEAR:
|
|
|
|
/**
|
|
|
|
* \todo win32 clear operation deletes the contents of
|
|
|
|
* the selection but ns clear selection only
|
|
|
|
* removes the highlight.
|
|
|
|
*/
|
|
|
|
browser_window_key_press(gw->bw, NS_KEY_CLEAR_SELECTION);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
}
|
|
|
|
return DefWindowProc(hwnd, msg, wparam, lparam);
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Create a drawable window.
|
|
|
|
*/
|
|
|
|
HWND
|
2017-02-17 23:44:37 +03:00
|
|
|
nsws_window_create_drawable(HINSTANCE hinstance,
|
|
|
|
HWND hparent,
|
2011-04-04 02:01:37 +04:00
|
|
|
struct gui_window *gw)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
2019-05-10 01:27:59 +03:00
|
|
|
hwnd = CreateWindowExW(0,
|
|
|
|
windowclassname_drawable,
|
|
|
|
NULL,
|
|
|
|
WS_VISIBLE | WS_CHILD,
|
|
|
|
0, 0,
|
|
|
|
0, 0,
|
|
|
|
hparent,
|
|
|
|
NULL,
|
|
|
|
hinstance,
|
|
|
|
NULL);
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
if (hwnd == NULL) {
|
|
|
|
win_perror("WindowCreateDrawable");
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Window creation failed");
|
2011-04-04 02:01:37 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the gui window associated with this toolbar */
|
|
|
|
SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
|
|
|
|
|
|
|
|
return hwnd;
|
|
|
|
}
|
|
|
|
|
2017-02-17 23:44:37 +03:00
|
|
|
|
2011-04-04 02:01:37 +04:00
|
|
|
/**
|
|
|
|
* Create the drawable window class.
|
|
|
|
*/
|
|
|
|
nserror
|
|
|
|
nsws_create_drawable_class(HINSTANCE hinstance) {
|
|
|
|
nserror ret = NSERROR_OK;
|
2019-05-10 01:27:59 +03:00
|
|
|
WNDCLASSEXW w;
|
2011-04-04 02:01:37 +04:00
|
|
|
|
|
|
|
/* drawable area */
|
|
|
|
w.cbSize = sizeof(WNDCLASSEX);
|
|
|
|
w.style = 0;
|
|
|
|
w.lpfnWndProc = nsws_window_drawable_event_callback;
|
|
|
|
w.cbClsExtra = 0;
|
|
|
|
w.cbWndExtra = 0;
|
|
|
|
w.hInstance = hinstance;
|
|
|
|
w.hIcon = NULL;
|
|
|
|
w.hCursor = NULL;
|
|
|
|
w.hbrBackground = (HBRUSH)(COLOR_MENU + 1);
|
|
|
|
w.lpszMenuName = NULL;
|
|
|
|
w.lpszClassName = windowclassname_drawable;
|
|
|
|
w.hIconSm = NULL;
|
|
|
|
|
2019-05-10 01:27:59 +03:00
|
|
|
if (RegisterClassExW(&w) == 0) {
|
2011-04-04 02:01:37 +04:00
|
|
|
win_perror("DrawableClass");
|
|
|
|
ret = NSERROR_INIT_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|