wineconsole: Move window handle to inner_data structure.

oldstable
Kirill K. Smirnov 2007-08-23 19:14:58 +04:00 committed by Alexandre Julliard
parent 2918a272e3
commit 945f4a7946
5 changed files with 58 additions and 57 deletions

View File

@ -953,6 +953,7 @@ enum init_return WCCURSES_InitBackend(struct inner_data* data)
data->fnScroll = WCCURSES_Scroll; data->fnScroll = WCCURSES_Scroll;
data->fnSetFont = WCCURSES_SetFont; data->fnSetFont = WCCURSES_SetFont;
data->fnDeleteBackend = WCCURSES_DeleteBackend; data->fnDeleteBackend = WCCURSES_DeleteBackend;
data->hWnd = NULL;
if (wine_server_fd_to_handle(0, GENERIC_READ|SYNCHRONIZE, 0, if (wine_server_fd_to_handle(0, GENERIC_READ|SYNCHRONIZE, 0,
(obj_handle_t*)&PRIVATE(data)->hInput)) (obj_handle_t*)&PRIVATE(data)->hInput))

View File

@ -434,7 +434,7 @@ static BOOL select_font(struct dialog_info* di)
WCUSER_FillLogFont(&lf, di->font[size_idx].faceName, WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
di->font[size_idx].height, di->font[size_idx].weight); di->font[size_idx].height, di->font[size_idx].weight);
hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf, NULL); hFont = WCUSER_CopyFont(&config, di->data->hWnd, &lf, NULL);
if (!hFont) return FALSE; if (!hFont) return FALSE;
if (config.cell_height != di->font[size_idx].height) if (config.cell_height != di->font[size_idx].height)
@ -573,7 +573,7 @@ static INT_PTR WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
WCUSER_FillLogFont(&lf, di->font[val].faceName, WCUSER_FillLogFont(&lf, di->font[val].faceName,
di->font[val].height, di->font[val].weight); di->font[val].height, di->font[val].weight);
DeleteObject(WCUSER_CopyFont(&di->config, DeleteObject(WCUSER_CopyFont(&di->config,
PRIVATE(di->data)->hWnd, &lf, NULL)); di->data->hWnd, &lf, NULL));
} }
val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) | val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
@ -831,7 +831,7 @@ BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
psHead.pszCaption = buff; psHead.pszCaption = buff;
psHead.nPages = 3; psHead.nPages = 3;
psHead.hwndParent = PRIVATE(data)->hWnd; psHead.hwndParent = data->hWnd;
psHead.u3.phpage = psPage; psHead.u3.phpage = psPage;
WINECON_DumpConfig("init", refcfg); WINECON_DumpConfig("init", refcfg);
@ -846,7 +846,7 @@ BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
if (refcfg == &data->curcfg) if (refcfg == &data->curcfg)
{ {
switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS), switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS),
PRIVATE(data)->hWnd, WCUSER_SaveDlgProc)) data->hWnd, WCUSER_SaveDlgProc))
{ {
case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break; case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break;
case IDC_SAV_SESSION: modify_session = TRUE; break; case IDC_SAV_SESSION: modify_session = TRUE; break;

View File

@ -111,12 +111,12 @@ static void WCUSER_NewBitmap(struct inner_data* data)
HBITMAP hnew, hold; HBITMAP hnew, hold;
if (!data->curcfg.sb_width || !data->curcfg.sb_height || if (!data->curcfg.sb_width || !data->curcfg.sb_height ||
!PRIVATE(data)->hFont || !(hDC = GetDC(PRIVATE(data)->hWnd))) !PRIVATE(data)->hFont || !(hDC = GetDC(data->hWnd)))
return; return;
hnew = CreateCompatibleBitmap(hDC, hnew = CreateCompatibleBitmap(hDC,
data->curcfg.sb_width * data->curcfg.cell_width, data->curcfg.sb_width * data->curcfg.cell_width,
data->curcfg.sb_height * data->curcfg.cell_height); data->curcfg.sb_height * data->curcfg.cell_height);
ReleaseDC(PRIVATE(data)->hWnd, hDC); ReleaseDC(data->hWnd, hDC);
hold = SelectObject(PRIVATE(data)->hMemDC, hnew); hold = SelectObject(PRIVATE(data)->hMemDC, hnew);
if (PRIVATE(data)->hBitmap) if (PRIVATE(data)->hBitmap)
@ -147,11 +147,11 @@ static void WCUSER_ResizeScreenBuffer(struct inner_data* data)
*/ */
static void WCUSER_PosCursor(const struct inner_data* data) static void WCUSER_PosCursor(const struct inner_data* data)
{ {
if (PRIVATE(data)->hWnd != GetFocus() || !data->curcfg.cursor_visible) return; if (data->hWnd != GetFocus() || !data->curcfg.cursor_visible) return;
SetCaretPos((data->cursor.X - data->curcfg.win_pos.X) * data->curcfg.cell_width, SetCaretPos((data->cursor.X - data->curcfg.win_pos.X) * data->curcfg.cell_width,
(data->cursor.Y - data->curcfg.win_pos.Y) * data->curcfg.cell_height); (data->cursor.Y - data->curcfg.win_pos.Y) * data->curcfg.cell_height);
ShowCaret(PRIVATE(data)->hWnd); ShowCaret(data->hWnd);
} }
/****************************************************************** /******************************************************************
@ -163,7 +163,7 @@ static void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL
{ {
if (force || size != data->curcfg.cursor_size) if (force || size != data->curcfg.cursor_size)
{ {
if (data->curcfg.cursor_visible && PRIVATE(data)->hWnd == GetFocus()) DestroyCaret(); if (data->curcfg.cursor_visible && data->hWnd == GetFocus()) DestroyCaret();
if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap); if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap);
PRIVATE(data)->cursor_bitmap = NULL; PRIVATE(data)->cursor_bitmap = NULL;
if (size != 100) if (size != 100)
@ -195,11 +195,11 @@ static void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL
if (force || vis != data->curcfg.cursor_visible) if (force || vis != data->curcfg.cursor_visible)
{ {
data->curcfg.cursor_visible = vis; data->curcfg.cursor_visible = vis;
if (PRIVATE(data)->hWnd == GetFocus()) if (data->hWnd == GetFocus())
{ {
if (vis) if (vis)
{ {
CreateCaret(PRIVATE(data)->hWnd, PRIVATE(data)->cursor_bitmap, CreateCaret(data->hWnd, PRIVATE(data)->cursor_bitmap,
data->curcfg.cell_width, data->curcfg.cell_height); data->curcfg.cell_width, data->curcfg.cell_height);
WCUSER_PosCursor(data); WCUSER_PosCursor(data);
} }
@ -229,36 +229,36 @@ static void WCUSER_ComputePositions(struct inner_data* data)
if (IsRectEmpty(&r)) return; if (IsRectEmpty(&r)) return;
AdjustWindowRect(&r, GetWindowLong(PRIVATE(data)->hWnd, GWL_STYLE), FALSE); AdjustWindowRect(&r, GetWindowLong(data->hWnd, GWL_STYLE), FALSE);
dx = dy = 0; dx = dy = 0;
if (data->curcfg.sb_width > data->curcfg.win_width) if (data->curcfg.sb_width > data->curcfg.win_width)
{ {
dy = GetSystemMetrics(SM_CYHSCROLL); dy = GetSystemMetrics(SM_CYHSCROLL);
SetScrollRange(PRIVATE(data)->hWnd, SB_HORZ, 0, SetScrollRange(data->hWnd, SB_HORZ, 0,
data->curcfg.sb_width - data->curcfg.win_width, FALSE); data->curcfg.sb_width - data->curcfg.win_width, FALSE);
SetScrollPos(PRIVATE(data)->hWnd, SB_HORZ, 0, FALSE); /* FIXME */ SetScrollPos(data->hWnd, SB_HORZ, 0, FALSE); /* FIXME */
ShowScrollBar(PRIVATE(data)->hWnd, SB_HORZ, TRUE); ShowScrollBar(data->hWnd, SB_HORZ, TRUE);
} }
else else
{ {
ShowScrollBar(PRIVATE(data)->hWnd, SB_HORZ, FALSE); ShowScrollBar(data->hWnd, SB_HORZ, FALSE);
} }
if (data->curcfg.sb_height > data->curcfg.win_height) if (data->curcfg.sb_height > data->curcfg.win_height)
{ {
dx = GetSystemMetrics(SM_CXVSCROLL); dx = GetSystemMetrics(SM_CXVSCROLL);
SetScrollRange(PRIVATE(data)->hWnd, SB_VERT, 0, SetScrollRange(data->hWnd, SB_VERT, 0,
data->curcfg.sb_height - data->curcfg.win_height, FALSE); data->curcfg.sb_height - data->curcfg.win_height, FALSE);
SetScrollPos(PRIVATE(data)->hWnd, SB_VERT, 0, FALSE); /* FIXME */ SetScrollPos(data->hWnd, SB_VERT, 0, FALSE); /* FIXME */
ShowScrollBar(PRIVATE(data)->hWnd, SB_VERT, TRUE); ShowScrollBar(data->hWnd, SB_VERT, TRUE);
} }
else else
{ {
ShowScrollBar(PRIVATE(data)->hWnd, SB_VERT, FALSE); ShowScrollBar(data->hWnd, SB_VERT, FALSE);
} }
SetWindowPos(PRIVATE(data)->hWnd, 0, 0, 0, r.right - r.left + dx, r.bottom - r.top + dy, SetWindowPos(data->hWnd, 0, 0, 0, r.right - r.left + dx, r.bottom - r.top + dy,
SWP_NOMOVE|SWP_NOZORDER); SWP_NOMOVE|SWP_NOZORDER);
WCUSER_ShapeCursor(data, data->curcfg.cursor_size, data->curcfg.cursor_visible, TRUE); WCUSER_ShapeCursor(data, data->curcfg.cursor_size, data->curcfg.cursor_visible, TRUE);
WCUSER_PosCursor(data); WCUSER_PosCursor(data);
@ -274,7 +274,7 @@ static void WCUSER_SetTitle(const struct inner_data* data)
WCHAR buffer[256]; WCHAR buffer[256];
if (WINECON_GetConsoleTitle(data->hConIn, buffer, sizeof(buffer))) if (WINECON_GetConsoleTitle(data->hConIn, buffer, sizeof(buffer)))
SetWindowText(PRIVATE(data)->hWnd, buffer); SetWindowText(data->hWnd, buffer);
} }
void WCUSER_DumpLogFont(const char* pfx, const LOGFONT* lf, DWORD ft) void WCUSER_DumpLogFont(const char* pfx, const LOGFONT* lf, DWORD ft)
@ -524,7 +524,7 @@ BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont)
if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont)) if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont))
return TRUE; return TRUE;
hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont, &el); hFont = WCUSER_CopyFont(&data->curcfg, data->hWnd, logfont, &el);
if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;} if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;}
if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont); if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
@ -533,8 +533,8 @@ BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont)
WCUSER_ComputePositions(data); WCUSER_ComputePositions(data);
WCUSER_NewBitmap(data); WCUSER_NewBitmap(data);
InvalidateRect(PRIVATE(data)->hWnd, NULL, FALSE); InvalidateRect(data->hWnd, NULL, FALSE);
UpdateWindow(PRIVATE(data)->hWnd); UpdateWindow(data->hWnd);
return TRUE; return TRUE;
} }
@ -612,16 +612,16 @@ static void WCUSER_SetSelection(const struct inner_data* data, HDC hRefDC)
RECT r; RECT r;
WCUSER_GetSelectionRect(data, &r); WCUSER_GetSelectionRect(data, &r);
hDC = hRefDC ? hRefDC : GetDC(PRIVATE(data)->hWnd); hDC = hRefDC ? hRefDC : GetDC(data->hWnd);
if (hDC) if (hDC)
{ {
if (PRIVATE(data)->hWnd == GetFocus() && data->curcfg.cursor_visible) if (data->hWnd == GetFocus() && data->curcfg.cursor_visible)
HideCaret(PRIVATE(data)->hWnd); HideCaret(data->hWnd);
InvertRect(hDC, &r); InvertRect(hDC, &r);
if (hDC != hRefDC) if (hDC != hRefDC)
ReleaseDC(PRIVATE(data)->hWnd, hDC); ReleaseDC(data->hWnd, hDC);
if (PRIVATE(data)->hWnd == GetFocus() && data->curcfg.cursor_visible) if (data->hWnd == GetFocus() && data->curcfg.cursor_visible)
ShowCaret(PRIVATE(data)->hWnd); ShowCaret(data->hWnd);
} }
} }
@ -642,11 +642,11 @@ static void WCUSER_MoveSelection(struct inner_data* data, COORD c1, COORD c2)
return; return;
WCUSER_GetSelectionRect(data, &r); WCUSER_GetSelectionRect(data, &r);
hDC = GetDC(PRIVATE(data)->hWnd); hDC = GetDC(data->hWnd);
if (hDC) if (hDC)
{ {
if (PRIVATE(data)->hWnd == GetFocus() && data->curcfg.cursor_visible) if (data->hWnd == GetFocus() && data->curcfg.cursor_visible)
HideCaret(PRIVATE(data)->hWnd); HideCaret(data->hWnd);
InvertRect(hDC, &r); InvertRect(hDC, &r);
} }
PRIVATE(data)->selectPt1 = c1; PRIVATE(data)->selectPt1 = c1;
@ -655,9 +655,9 @@ static void WCUSER_MoveSelection(struct inner_data* data, COORD c1, COORD c2)
{ {
WCUSER_GetSelectionRect(data, &r); WCUSER_GetSelectionRect(data, &r);
InvertRect(hDC, &r); InvertRect(hDC, &r);
ReleaseDC(PRIVATE(data)->hWnd, hDC); ReleaseDC(data->hWnd, hDC);
if (PRIVATE(data)->hWnd == GetFocus() && data->curcfg.cursor_visible) if (data->hWnd == GetFocus() && data->curcfg.cursor_visible)
ShowCaret(PRIVATE(data)->hWnd); ShowCaret(data->hWnd);
} }
} }
@ -675,7 +675,7 @@ static void WCUSER_CopySelectionToClipboard(const struct inner_data* data)
w = abs(PRIVATE(data)->selectPt1.X - PRIVATE(data)->selectPt2.X) + 2; w = abs(PRIVATE(data)->selectPt1.X - PRIVATE(data)->selectPt2.X) + 2;
h = abs(PRIVATE(data)->selectPt1.Y - PRIVATE(data)->selectPt2.Y) + 1; h = abs(PRIVATE(data)->selectPt1.Y - PRIVATE(data)->selectPt2.Y) + 1;
if (!OpenClipboard(PRIVATE(data)->hWnd)) return; if (!OpenClipboard(data->hWnd)) return;
EmptyClipboard(); EmptyClipboard();
hMem = GlobalAlloc(GMEM_MOVEABLE, (w * h) * sizeof(WCHAR)); hMem = GlobalAlloc(GMEM_MOVEABLE, (w * h) * sizeof(WCHAR));
@ -715,7 +715,7 @@ static void WCUSER_PasteFromClipboard(struct inner_data* data)
HANDLE h; HANDLE h;
WCHAR* ptr; WCHAR* ptr;
if (!OpenClipboard(PRIVATE(data)->hWnd)) return; if (!OpenClipboard(data->hWnd)) return;
h = GetClipboardData(CF_UNICODETEXT); h = GetClipboardData(CF_UNICODETEXT);
if (h && (ptr = GlobalLock(h))) if (h && (ptr = GlobalLock(h)))
{ {
@ -764,8 +764,8 @@ static void WCUSER_Refresh(const struct inner_data* data, int tp, int bm)
r.right = data->curcfg.win_width * data->curcfg.cell_width; r.right = data->curcfg.win_width * data->curcfg.cell_width;
r.top = (tp - data->curcfg.win_pos.Y) * data->curcfg.cell_height; r.top = (tp - data->curcfg.win_pos.Y) * data->curcfg.cell_height;
r.bottom = (bm - data->curcfg.win_pos.Y + 1) * data->curcfg.cell_height; r.bottom = (bm - data->curcfg.win_pos.Y + 1) * data->curcfg.cell_height;
InvalidateRect(PRIVATE(data)->hWnd, &r, FALSE); InvalidateRect(data->hWnd, &r, FALSE);
UpdateWindow(PRIVATE(data)->hWnd); UpdateWindow(data->hWnd);
} }
} }
@ -778,7 +778,7 @@ static void WCUSER_Paint(const struct inner_data* data)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
BeginPaint(PRIVATE(data)->hWnd, &ps); BeginPaint(data->hWnd, &ps);
BitBlt(ps.hdc, 0, 0, BitBlt(ps.hdc, 0, 0,
data->curcfg.win_width * data->curcfg.cell_width, data->curcfg.win_width * data->curcfg.cell_width,
data->curcfg.win_height * data->curcfg.cell_height, data->curcfg.win_height * data->curcfg.cell_height,
@ -788,7 +788,7 @@ static void WCUSER_Paint(const struct inner_data* data)
SRCCOPY); SRCCOPY);
if (PRIVATE(data)->has_selection) if (PRIVATE(data)->has_selection)
WCUSER_SetSelection(data, ps.hdc); WCUSER_SetSelection(data, ps.hdc);
EndPaint(PRIVATE(data)->hWnd, &ps); EndPaint(data->hWnd, &ps);
} }
/****************************************************************** /******************************************************************
@ -800,15 +800,15 @@ static void WCUSER_Scroll(struct inner_data* data, int pos, BOOL horz)
{ {
if (horz) if (horz)
{ {
SetScrollPos(PRIVATE(data)->hWnd, SB_HORZ, pos, TRUE); SetScrollPos(data->hWnd, SB_HORZ, pos, TRUE);
data->curcfg.win_pos.X = pos; data->curcfg.win_pos.X = pos;
} }
else else
{ {
SetScrollPos(PRIVATE(data)->hWnd, SB_VERT, pos, TRUE); SetScrollPos(data->hWnd, SB_VERT, pos, TRUE);
data->curcfg.win_pos.Y = pos; data->curcfg.win_pos.Y = pos;
} }
InvalidateRect(PRIVATE(data)->hWnd, NULL, FALSE); InvalidateRect(data->hWnd, NULL, FALSE);
} }
/****************************************************************** /******************************************************************
@ -882,7 +882,7 @@ static LRESULT WCUSER_Create(HWND hWnd, LPCREATESTRUCT lpcs)
data = lpcs->lpCreateParams; data = lpcs->lpCreateParams;
SetWindowLongPtr(hWnd, 0L, (DWORD_PTR)data); SetWindowLongPtr(hWnd, 0L, (DWORD_PTR)data);
PRIVATE(data)->hWnd = hWnd; data->hWnd = hWnd;
hSysMenu = GetSystemMenu(hWnd, FALSE); hSysMenu = GetSystemMenu(hWnd, FALSE);
if (!hSysMenu) return 0; if (!hSysMenu) return 0;
@ -1104,7 +1104,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_CREATE: case WM_CREATE:
return WCUSER_Create(hWnd, (LPCREATESTRUCT)lParam); return WCUSER_Create(hWnd, (LPCREATESTRUCT)lParam);
case WM_DESTROY: case WM_DESTROY:
PRIVATE(data)->hWnd = 0; data->hWnd = 0;
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_PAINT: case WM_PAINT:
@ -1134,7 +1134,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
else else
{ {
PRIVATE(data)->selectPt1 = PRIVATE(data)->selectPt2 = WCUSER_GetCell(data, lParam); PRIVATE(data)->selectPt1 = PRIVATE(data)->selectPt2 = WCUSER_GetCell(data, lParam);
SetCapture(PRIVATE(data)->hWnd); SetCapture(data->hWnd);
WCUSER_SetSelection(data, 0); WCUSER_SetSelection(data, 0);
PRIVATE(data)->has_selection = TRUE; PRIVATE(data)->has_selection = TRUE;
} }
@ -1147,7 +1147,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if (data->curcfg.quick_edit || PRIVATE(data)->has_selection) if (data->curcfg.quick_edit || PRIVATE(data)->has_selection)
{ {
if (GetCapture() == PRIVATE(data)->hWnd && PRIVATE(data)->has_selection && if (GetCapture() == data->hWnd && PRIVATE(data)->has_selection &&
(wParam & MK_LBUTTON)) (wParam & MK_LBUTTON))
{ {
WCUSER_MoveSelection(data, PRIVATE(data)->selectPt1, WCUSER_GetCell(data, lParam)); WCUSER_MoveSelection(data, PRIVATE(data)->selectPt1, WCUSER_GetCell(data, lParam));
@ -1161,7 +1161,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_LBUTTONUP: case WM_LBUTTONUP:
if (data->curcfg.quick_edit || PRIVATE(data)->has_selection) if (data->curcfg.quick_edit || PRIVATE(data)->has_selection)
{ {
if (GetCapture() == PRIVATE(data)->hWnd && PRIVATE(data)->has_selection) if (GetCapture() == data->hWnd && PRIVATE(data)->has_selection)
{ {
WCUSER_MoveSelection(data, PRIVATE(data)->selectPt1, WCUSER_GetCell(data, lParam)); WCUSER_MoveSelection(data, PRIVATE(data)->selectPt1, WCUSER_GetCell(data, lParam));
ReleaseCapture(); ReleaseCapture();
@ -1207,7 +1207,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_SETFOCUS: case WM_SETFOCUS:
if (data->curcfg.cursor_visible) if (data->curcfg.cursor_visible)
{ {
CreateCaret(PRIVATE(data)->hWnd, PRIVATE(data)->cursor_bitmap, CreateCaret(data->hWnd, PRIVATE(data)->cursor_bitmap,
data->curcfg.cell_width, data->curcfg.cell_height); data->curcfg.cell_width, data->curcfg.cell_height);
WCUSER_PosCursor(data); WCUSER_PosCursor(data);
} }
@ -1328,7 +1328,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
break; break;
case WM_INITMENUPOPUP: case WM_INITMENUPOPUP:
if (!HIWORD(lParam)) return DefWindowProc(hWnd, uMsg, wParam, lParam); if (!HIWORD(lParam)) return DefWindowProc(hWnd, uMsg, wParam, lParam);
WCUSER_SetMenuDetails(data, GetSystemMenu(PRIVATE(data)->hWnd, FALSE)); WCUSER_SetMenuDetails(data, GetSystemMenu(data->hWnd, FALSE));
break; break;
default: default:
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);
@ -1345,7 +1345,7 @@ static void WCUSER_DeleteBackend(struct inner_data* data)
{ {
if (!PRIVATE(data)) return; if (!PRIVATE(data)) return;
if (PRIVATE(data)->hMemDC) DeleteDC(PRIVATE(data)->hMemDC); if (PRIVATE(data)->hMemDC) DeleteDC(PRIVATE(data)->hMemDC);
if (PRIVATE(data)->hWnd) DestroyWindow(PRIVATE(data)->hWnd); if (data->hWnd) DestroyWindow(data->hWnd);
if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont); if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap); if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap);
if (PRIVATE(data)->hBitmap) DeleteObject(PRIVATE(data)->hBitmap); if (PRIVATE(data)->hBitmap) DeleteObject(PRIVATE(data)->hBitmap);
@ -1361,7 +1361,7 @@ static int WCUSER_MainLoop(struct inner_data* data)
{ {
MSG msg; MSG msg;
ShowWindow(PRIVATE(data)->hWnd, data->nCmdShow); ShowWindow(data->hWnd, data->nCmdShow);
for (;;) for (;;)
{ {
switch (MsgWaitForMultipleObjects(1, &data->hSynchro, FALSE, INFINITE, QS_ALLINPUT)) switch (MsgWaitForMultipleObjects(1, &data->hSynchro, FALSE, INFINITE, QS_ALLINPUT))
@ -1437,7 +1437,7 @@ enum init_return WCUSER_InitBackend(struct inner_data* data)
CreateWindow(wndclass.lpszClassName, NULL, CreateWindow(wndclass.lpszClassName, NULL,
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_HSCROLL|WS_VSCROLL, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_HSCROLL|WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, 0, wndclass.hInstance, data); CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, 0, wndclass.hInstance, data);
if (!PRIVATE(data)->hWnd) return init_failed; if (!data->hWnd) return init_failed;
return init_success; return init_success;
} }

View File

@ -58,6 +58,7 @@ struct inner_data {
HANDLE hConIn; /* console input handle */ HANDLE hConIn; /* console input handle */
HANDLE hConOut; /* screen buffer handle: has to be changed when active sb changes */ HANDLE hConOut; /* screen buffer handle: has to be changed when active sb changes */
HANDLE hSynchro; /* waitable handle signalled by server when something in server has been modified */ HANDLE hSynchro; /* waitable handle signalled by server when something in server has been modified */
HWND hWnd; /* handle of 'user' window or NULL for 'curses' */
INT nCmdShow; /* argument of WinMain */ INT nCmdShow; /* argument of WinMain */
int (*fnMainLoop)(struct inner_data* data); int (*fnMainLoop)(struct inner_data* data);

View File

@ -28,7 +28,6 @@
struct inner_data_user { struct inner_data_user {
/* the following fields are only user by the USER backend (should be hidden in user) */ /* the following fields are only user by the USER backend (should be hidden in user) */
HWND hWnd; /* handle to windows for rendering */
HFONT hFont; /* font used for rendering, usually fixed */ HFONT hFont; /* font used for rendering, usually fixed */
LONG ext_leading; /* external leading for hFont */ LONG ext_leading; /* external leading for hFont */
HDC hMemDC; /* memory DC holding the bitmap below */ HDC hMemDC; /* memory DC holding the bitmap below */