Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
544dbb51
Commit
544dbb51
authored
Nov 15, 2010
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineconsole: Properly manage window position (in wineconsole) from within wineserver.
parent
b53edc6d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
83 deletions
+52
-83
curses.c
programs/wineconsole/curses.c
+7
-8
user.c
programs/wineconsole/user.c
+25
-36
winecon_private.h
programs/wineconsole/winecon_private.h
+0
-1
wineconsole.c
programs/wineconsole/wineconsole.c
+20
-38
No files found.
programs/wineconsole/curses.c
View file @
544dbb51
...
...
@@ -422,17 +422,16 @@ static void WCCURSES_SetFont(struct inner_data* data, const WCHAR* font,
*/
static
void
WCCURSES_ScrollV
(
struct
inner_data
*
data
,
int
delta
)
{
int
pos
=
data
->
curcfg
.
win_pos
.
Y
;
struct
config_data
cfg
=
data
->
curcfg
;
pos
+=
delta
;
if
(
pos
<
0
)
pos
=
0
;
if
(
pos
>
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
)
pos
=
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
;
if
(
pos
!=
data
->
curcfg
.
win_pos
.
Y
)
cfg
.
win_pos
.
Y
+=
delta
;
if
(
cfg
.
win_pos
.
Y
<
0
)
cfg
.
win_pos
.
Y
=
0
;
if
(
cfg
.
win_pos
.
Y
>
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
)
cfg
.
win_pos
.
Y
=
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
;
if
(
cfg
.
win_pos
.
Y
!=
data
->
curcfg
.
win_pos
.
Y
)
{
data
->
curcfg
.
win_pos
.
Y
=
pos
;
WCCURSES_PosCursor
(
data
);
WINECON_
NotifyWindowChange
(
data
);
WINECON_
SetConfig
(
data
,
&
cfg
);
}
}
...
...
programs/wineconsole/user.c
View file @
544dbb51
...
...
@@ -800,11 +800,13 @@ static void WCUSER_Scroll(struct inner_data* data, int pos, BOOL horz)
{
if
(
horz
)
{
ScrollWindow
(
data
->
hWnd
,
(
data
->
curcfg
.
win_pos
.
X
-
pos
)
*
data
->
curcfg
.
cell_width
,
0
,
NULL
,
NULL
);
SetScrollPos
(
data
->
hWnd
,
SB_HORZ
,
pos
,
TRUE
);
data
->
curcfg
.
win_pos
.
X
=
pos
;
}
else
{
ScrollWindow
(
data
->
hWnd
,
0
,
(
data
->
curcfg
.
win_pos
.
Y
-
pos
)
*
data
->
curcfg
.
cell_height
,
NULL
,
NULL
);
SetScrollPos
(
data
->
hWnd
,
SB_VERT
,
pos
,
TRUE
);
data
->
curcfg
.
win_pos
.
Y
=
pos
;
}
...
...
@@ -1211,29 +1213,23 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
break
;
case
WM_HSCROLL
:
{
int
pos
=
data
->
curcfg
.
win_pos
.
X
;
struct
config_data
cfg
=
data
->
curcfg
;
switch
(
LOWORD
(
wParam
))
{
case
SB_PAGEUP
:
pos
-=
8
;
break
;
case
SB_PAGEDOWN
:
pos
+=
8
;
break
;
case
SB_LINEUP
:
pos
--
;
break
;
case
SB_LINEDOWN
:
pos
++
;
break
;
case
SB_THUMBTRACK
:
pos
=
HIWORD
(
wParam
);
break
;
case
SB_PAGEUP
:
cfg
.
win_pos
.
X
-=
8
;
break
;
case
SB_PAGEDOWN
:
cfg
.
win_pos
.
X
+=
8
;
break
;
case
SB_LINEUP
:
cfg
.
win_pos
.
X
--
;
break
;
case
SB_LINEDOWN
:
cfg
.
win_pos
.
X
++
;
break
;
case
SB_THUMBTRACK
:
cfg
.
win_pos
.
X
=
HIWORD
(
wParam
);
break
;
default:
break
;
}
if
(
pos
<
0
)
pos
=
0
;
if
(
pos
>
data
->
curcfg
.
sb_width
-
data
->
curcfg
.
win_width
)
pos
=
data
->
curcfg
.
sb_width
-
data
->
curcfg
.
win_width
;
if
(
pos
!=
data
->
curcfg
.
win_pos
.
X
)
if
(
cfg
.
win_pos
.
X
<
0
)
cfg
.
win_pos
.
X
=
0
;
if
(
cfg
.
win_pos
.
X
>
data
->
curcfg
.
sb_width
-
data
->
curcfg
.
win_width
)
cfg
.
win_pos
.
X
=
data
->
curcfg
.
sb_width
-
data
->
curcfg
.
win_width
;
if
(
cfg
.
win_pos
.
X
!=
data
->
curcfg
.
win_pos
.
X
)
{
ScrollWindow
(
hWnd
,
(
data
->
curcfg
.
win_pos
.
X
-
pos
)
*
data
->
curcfg
.
cell_width
,
0
,
NULL
,
NULL
);
data
->
curcfg
.
win_pos
.
X
=
pos
;
SetScrollPos
(
hWnd
,
SB_HORZ
,
pos
,
TRUE
);
UpdateWindow
(
hWnd
);
WCUSER_PosCursor
(
data
);
WINECON_NotifyWindowChange
(
data
);
WINECON_SetConfig
(
data
,
&
cfg
);
}
}
break
;
...
...
@@ -1246,40 +1242,33 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
/* else fallthrough */
case
WM_VSCROLL
:
{
int
pos
=
data
->
curcfg
.
win_pos
.
Y
;
struct
config_data
cfg
=
data
->
curcfg
;
if
(
uMsg
==
WM_MOUSEWHEEL
)
{
UINT
scrollLines
=
3
;
SystemParametersInfoW
(
SPI_GETWHEELSCROLLLINES
,
0
,
&
scrollLines
,
0
);
scrollLines
*=
-
GET_WHEEL_DELTA_WPARAM
(
wParam
)
/
WHEEL_DELTA
;
pos
+=
scrollLines
;
cfg
.
win_pos
.
Y
+=
scrollLines
;
}
else
{
switch
(
LOWORD
(
wParam
))
{
case
SB_PAGEUP
:
pos
-=
8
;
break
;
case
SB_PAGEDOWN
:
pos
+=
8
;
break
;
case
SB_LINEUP
:
pos
--
;
break
;
case
SB_LINEDOWN
:
pos
++
;
break
;
case
SB_THUMBTRACK
:
pos
=
HIWORD
(
wParam
);
break
;
case
SB_PAGEUP
:
cfg
.
win_pos
.
Y
-=
8
;
break
;
case
SB_PAGEDOWN
:
cfg
.
win_pos
.
Y
+=
8
;
break
;
case
SB_LINEUP
:
cfg
.
win_pos
.
Y
--
;
break
;
case
SB_LINEDOWN
:
cfg
.
win_pos
.
Y
++
;
break
;
case
SB_THUMBTRACK
:
cfg
.
win_pos
.
Y
=
HIWORD
(
wParam
);
break
;
default:
break
;
}
}
if
(
pos
<
0
)
pos
=
0
;
if
(
pos
>
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
)
pos
=
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
;
if
(
pos
!=
data
->
curcfg
.
win_pos
.
Y
)
if
(
cfg
.
win_pos
.
Y
<
0
)
cfg
.
win_pos
.
Y
=
0
;
if
(
cfg
.
win_pos
.
Y
>
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
)
cfg
.
win_pos
.
Y
=
data
->
curcfg
.
sb_height
-
data
->
curcfg
.
win_height
;
if
(
cfg
.
win_pos
.
Y
!=
data
->
curcfg
.
win_pos
.
Y
)
{
ScrollWindow
(
hWnd
,
0
,
(
data
->
curcfg
.
win_pos
.
Y
-
pos
)
*
data
->
curcfg
.
cell_height
,
NULL
,
NULL
);
data
->
curcfg
.
win_pos
.
Y
=
pos
;
SetScrollPos
(
hWnd
,
SB_VERT
,
pos
,
TRUE
);
UpdateWindow
(
hWnd
);
WCUSER_PosCursor
(
data
);
WINECON_NotifyWindowChange
(
data
);
WINECON_SetConfig
(
data
,
&
cfg
);
}
}
break
;
case
WM_SYSCOMMAND
:
...
...
programs/wineconsole/winecon_private.h
View file @
544dbb51
...
...
@@ -77,7 +77,6 @@ struct inner_data {
/* from wineconsole.c */
extern
void
WINECON_Fatal
(
const
char
*
msg
);
extern
void
WINECON_NotifyWindowChange
(
struct
inner_data
*
data
);
extern
int
WINECON_GetHistorySize
(
HANDLE
hConIn
);
extern
int
WINECON_GetHistoryMode
(
HANDLE
hConIn
);
extern
BOOL
WINECON_GetConsoleTitle
(
HANDLE
hConIn
,
WCHAR
*
buffer
,
size_t
len
);
...
...
programs/wineconsole/wineconsole.c
View file @
544dbb51
...
...
@@ -82,26 +82,6 @@ static void WINECON_FetchCells(struct inner_data* data, int upd_tp, int upd_bm)
}
/******************************************************************
* WINECON_NotifyWindowChange
*
* Inform server that visible window on sb has changed
*/
void
WINECON_NotifyWindowChange
(
struct
inner_data
*
data
)
{
SERVER_START_REQ
(
set_console_output_info
)
{
req
->
handle
=
wine_server_obj_handle
(
data
->
hConOut
);
req
->
win_left
=
data
->
curcfg
.
win_pos
.
X
;
req
->
win_top
=
data
->
curcfg
.
win_pos
.
Y
;
req
->
win_right
=
data
->
curcfg
.
win_pos
.
X
+
data
->
curcfg
.
win_width
-
1
;
req
->
win_bottom
=
data
->
curcfg
.
win_pos
.
Y
+
data
->
curcfg
.
win_height
-
1
;
req
->
mask
=
SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW
;
wine_server_call
(
req
);
}
SERVER_END_REQ
;
}
/******************************************************************
* WINECON_SetHistorySize
*
*
...
...
@@ -402,28 +382,30 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf
* The Change<A><B> actually modify the <B> dimension of <A>.
*/
#define TstSBfWidth() (data->curcfg.sb_width != cfg->sb_width)
#define TstWin
Width() (data->curcfg.win_width != cfg->win_width
)
#define TstWin
HPos() (data->curcfg.win_width != cfg->win_width || data->curcfg.win_pos.X != cfg->win_pos.X
)
#define ChgSBfWidth() do {c.X = cfg->sb_width; \
c.Y = data->curcfg.sb_height;\
SetConsoleScreenBufferSize(data->hConOut, c);\
} while (0)
#define ChgWinWidth() do {pos.Left = pos.Top = 0; \
pos.Right = cfg->win_width - data->curcfg.win_width; \
#define ChgWinHPos() do {pos.Left = cfg->win_pos.X - data->curcfg.win_pos.X; \
pos.Top = 0; \
pos.Right = pos.Left + cfg->win_width - data->curcfg.win_width; \
pos.Bottom = 0; \
SetConsoleWindowInfo(data->hConOut, FALSE, &pos);\
} while (0)
#define TstSBfHeight() (data->curcfg.sb_height != cfg->sb_height)
#define TstWin
Height() (data->curcfg.win_height != cfg->win_height
)
#define TstWin
VPos() (data->curcfg.win_height != cfg->win_height || data->curcfg.win_pos.Y != cfg->win_pos.Y
)
/* since we're going to apply height after width is done, we use width as defined
* in cfg, and not in data->curcfg because if won't be updated yet */
#define ChgSBfHeight() do {c.X = cfg->sb_width; c.Y = cfg->sb_height; \
SetConsoleScreenBufferSize(data->hConOut, c); \
} while (0)
#define ChgWinHeight() do {pos.Left = pos.Top = 0; \
#define ChgWinVPos() do {pos.Left = 0; \
pos.Top = cfg->win_pos.Y - data->curcfg.win_pos.Y; \
pos.Right = 0; \
pos.Bottom = cfg->win_height - data->curcfg.win_height; \
pos.Bottom =
pos.Top +
cfg->win_height - data->curcfg.win_height; \
SetConsoleWindowInfo(data->hConOut, FALSE, &pos);\
} while (0)
...
...
@@ -434,46 +416,46 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf
if
(
TstSBfWidth
())
{
if
(
TstWin
Width
())
if
(
TstWin
HPos
())
{
/* we're changing both at the same time, do it in the right order */
if
(
cfg
->
sb_width
>=
data
->
curcfg
.
win_width
)
{
ChgSBfWidth
();
ChgWin
Width
();
ChgSBfWidth
();
ChgWin
HPos
();
}
else
{
ChgWin
Width
();
ChgSBfWidth
();
ChgWin
HPos
();
ChgSBfWidth
();
}
}
else
ChgSBfWidth
();
}
else
if
(
TstWin
Width
())
ChgWinWidth
();
else
if
(
TstWin
HPos
())
ChgWinHPos
();
if
(
TstSBfHeight
())
{
if
(
TstWin
Height
())
if
(
TstWin
VPos
())
{
if
(
cfg
->
sb_height
>=
data
->
curcfg
.
win_height
)
{
ChgSBfHeight
();
ChgWin
Height
();
ChgSBfHeight
();
ChgWin
VPos
();
}
else
{
ChgWin
Height
();
ChgSBfHeight
();
ChgWin
VPos
();
ChgSBfHeight
();
}
}
else
ChgSBfHeight
();
}
else
if
(
TstWin
Height
())
ChgWinHeight
();
else
if
(
TstWin
VPos
())
ChgWinVPos
();
}
while
(
0
);
#undef TstSBfWidth
#undef TstWin
Width
#undef TstWin
HPos
#undef ChgSBfWidth
#undef ChgWin
Width
#undef ChgWin
HPos
#undef TstSBfHeight
#undef TstWin
Height
#undef TstWin
VPos
#undef ChgSBfHeight
#undef ChgWin
Height
#undef ChgWin
VPos
data
->
curcfg
.
exit_on_die
=
cfg
->
exit_on_die
;
if
(
data
->
curcfg
.
edition_mode
!=
cfg
->
edition_mode
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment