Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a65ef561
Commit
a65ef561
authored
Mar 19, 2002
by
Jukka Heinonen
Committed by
Alexandre Julliard
Mar 19, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Console mode DOS programs now receive mouse events.
Replaced GetMessage with PeekMessage, since MsgWaitForMultipleObjects is allowed to return spontaneously.
parent
53338721
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
57 deletions
+142
-57
dosexe.h
dlls/winedos/dosexe.h
+2
-0
dosvm.c
dlls/winedos/dosvm.c
+49
-33
int33.c
dlls/winedos/int33.c
+91
-24
No files found.
dlls/winedos/dosexe.h
View file @
a65ef561
...
...
@@ -24,6 +24,7 @@
#include "wine/windef16.h"
#include "winbase.h"
/* for LPSTARTUPINFO32A */
#include "winnt.h"
/* for PCONTEXT */
#include "wincon.h"
/* for MOUSE_EVENT_RECORD */
struct
_DOSEVENT
;
...
...
@@ -105,6 +106,7 @@ extern void WINAPI DOSVM_Int31Handler(CONTEXT86*);
/* int33.c */
extern
void
WINAPI
DOSVM_Int33Handler
(
CONTEXT86
*
);
extern
void
WINAPI
DOSVM_Int33Message
(
UINT
,
WPARAM
,
LPARAM
);
extern
void
WINAPI
DOSVM_Int33Console
(
MOUSE_EVENT_RECORD
*
);
/* int67.c */
extern
void
WINAPI
DOSVM_Int67Handler
(
CONTEXT86
*
);
...
...
dlls/winedos/dosvm.c
View file @
a65ef561
...
...
@@ -245,8 +245,20 @@ static void DOSVM_ProcessConsole(void)
}
DOSVM_Int09SendScan
(
scan
,
msg
.
Event
.
KeyEvent
.
uChar
.
AsciiChar
);
break
;
case
MOUSE_EVENT
:
DOSVM_Int33Console
(
&
msg
.
Event
.
MouseEvent
);
break
;
case
WINDOW_BUFFER_SIZE_EVENT
:
FIXME
(
"unhandled WINDOW_BUFFER_SIZE_EVENT.
\n
"
);
break
;
case
MENU_EVENT
:
FIXME
(
"unhandled MENU_EVENT.
\n
"
);
break
;
case
FOCUS_EVENT
:
FIXME
(
"unhandled FOCUS_EVENT.
\n
"
);
break
;
default:
FIXME
(
"un
handled
console event: %d
\n
"
,
msg
.
EventType
);
FIXME
(
"un
known
console event: %d
\n
"
,
msg
.
EventType
);
}
}
}
...
...
@@ -358,40 +370,44 @@ DWORD WINAPI DOSVM_Loop( LPVOID lpExtra )
DWORD
waitret
;
for
(;;)
{
TRACE_
(
int
)(
"waiting for action
\n
"
);
waitret
=
MsgWaitForMultipleObjects
(
1
,
&
obj
,
FALSE
,
INFINITE
,
QS_ALLINPUT
);
if
(
waitret
==
WAIT_OBJECT_0
)
{
DOSVM_ProcessConsole
();
}
else
if
(
waitret
==
WAIT_OBJECT_0
+
1
)
{
GetMessageA
(
&
msg
,
0
,
0
,
0
);
if
(
msg
.
hwnd
)
{
/* it's a window message */
DOSVM_ProcessMessage
(
&
msg
);
DispatchMessageA
(
&
msg
);
}
else
{
/* it's a thread message */
switch
(
msg
.
message
)
{
case
WM_QUIT
:
/* stop this madness!! */
return
0
;
case
WM_USER
:
/* run passed procedure in this thread */
/* (sort of like APC, but we signal the completion) */
{
DOS_SPC
*
spc
=
(
DOS_SPC
*
)
msg
.
lParam
;
TRACE_
(
int
)(
"calling %p with arg %08x
\n
"
,
spc
->
proc
,
spc
->
arg
);
(
spc
->
proc
)(
spc
->
arg
);
TRACE_
(
int
)(
"done, signalling event %d
\n
"
,
msg
.
wParam
);
SetEvent
(
msg
.
wParam
);
}
break
;
}
TRACE_
(
int
)(
"waiting for action
\n
"
);
waitret
=
MsgWaitForMultipleObjects
(
1
,
&
obj
,
FALSE
,
INFINITE
,
QS_ALLINPUT
);
if
(
waitret
==
WAIT_OBJECT_0
)
{
DOSVM_ProcessConsole
();
}
else
if
(
waitret
==
WAIT_OBJECT_0
+
1
)
{
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
{
if
(
msg
.
hwnd
)
{
/* it's a window message */
DOSVM_ProcessMessage
(
&
msg
);
DispatchMessageA
(
&
msg
);
}
else
{
/* it's a thread message */
switch
(
msg
.
message
)
{
case
WM_QUIT
:
/* stop this madness!! */
return
0
;
case
WM_USER
:
/* run passed procedure in this thread */
/* (sort of like APC, but we signal the completion) */
{
DOS_SPC
*
spc
=
(
DOS_SPC
*
)
msg
.
lParam
;
TRACE_
(
int
)(
"calling %p with arg %08x
\n
"
,
spc
->
proc
,
spc
->
arg
);
(
spc
->
proc
)(
spc
->
arg
);
TRACE_
(
int
)(
"done, signalling event %d
\n
"
,
msg
.
wParam
);
SetEvent
(
msg
.
wParam
);
}
break
;
}
}
}
}
else
{
ERR_
(
int
)(
"MsgWaitForMultipleObjects returned unexpected value.
\n
"
);
return
0
;
}
}
else
break
;
}
return
0
;
}
static
WINE_EXCEPTION_FILTER
(
exception_handler
)
...
...
dlls/winedos/int33.c
View file @
a65ef561
...
...
@@ -65,7 +65,8 @@ void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
FIXME
(
"Hide mouse cursor
\n
"
);
break
;
case
0x03
:
TRACE
(
"Return mouse position and button status
\n
"
);
TRACE
(
"Return mouse position and button status: (%ld,%ld) and %ld
\n
"
,
mouse_info
.
x
,
mouse_info
.
y
,
mouse_info
.
but
);
BX_reg
(
context
)
=
mouse_info
.
but
;
CX_reg
(
context
)
=
mouse_info
.
x
;
DX_reg
(
context
)
=
mouse_info
.
y
;
...
...
@@ -148,6 +149,58 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
DPMI_CallRMProc
(
&
ctx
,
NULL
,
0
,
0
);
}
static
void
QueueMouseRelay
(
DWORD
mx
,
DWORD
my
,
WORD
mask
)
{
mouse_info
.
x
=
mx
;
mouse_info
.
y
=
my
;
/* Left button down */
if
(
mask
&
0x02
)
{
mouse_info
.
but
|=
0x01
;
mouse_info
.
llastx
=
mx
;
mouse_info
.
llasty
=
my
;
mouse_info
.
lbcount
++
;
}
/* Left button up */
if
(
mask
&
0x04
)
{
mouse_info
.
but
&=
~
0x01
;
}
/* Right button down */
if
(
mask
&
0x08
)
{
mouse_info
.
but
|=
0x02
;
mouse_info
.
rlastx
=
mx
;
mouse_info
.
rlasty
=
my
;
mouse_info
.
rbcount
++
;
}
/* Right button up */
if
(
mask
&
0x10
)
{
mouse_info
.
but
&=
~
0x02
;
}
/* Middle button down */
if
(
mask
&
0x20
)
{
mouse_info
.
but
|=
0x04
;
}
/* Middle button up */
if
(
mask
&
0x40
)
{
mouse_info
.
but
&=
~
0x04
;
}
if
((
mask
&
mouse_info
.
callmask
)
&&
mouse_info
.
callback
)
{
MCALLDATA
*
data
=
calloc
(
1
,
sizeof
(
MCALLDATA
));
data
->
proc
=
mouse_info
.
callback
;
data
->
mask
=
mask
&
mouse_info
.
callmask
;
data
->
but
=
mouse_info
.
but
;
data
->
x
=
mouse_info
.
x
;
data
->
y
=
mouse_info
.
y
;
DOSVM_QueueEvent
(
-
1
,
DOS_PRIORITY_MOUSE
,
MouseRelay
,
data
);
}
}
void
WINAPI
DOSVM_Int33Message
(
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
WORD
mask
=
0
;
...
...
@@ -159,54 +212,68 @@ void WINAPI DOSVM_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
SX
=
640
/
Width
;
if
(
!
SX
)
SX
=
1
;
}
mouse_info
.
x
=
LOWORD
(
lParam
)
*
SX
;
mouse_info
.
y
=
HIWORD
(
lParam
)
*
SY
;
switch
(
message
)
{
case
WM_MOUSEMOVE
:
mask
|=
0x01
;
break
;
case
WM_LBUTTONDOWN
:
case
WM_LBUTTONDBLCLK
:
mouse_info
.
but
|=
0x01
;
mask
|=
0x02
;
mouse_info
.
llastx
=
mouse_info
.
x
;
mouse_info
.
llasty
=
mouse_info
.
y
;
mouse_info
.
lbcount
++
;
break
;
case
WM_LBUTTONUP
:
mouse_info
.
but
&=
~
0x01
;
mask
|=
0x04
;
break
;
case
WM_RBUTTONDOWN
:
case
WM_RBUTTONDBLCLK
:
mouse_info
.
but
|=
0x02
;
mask
|=
0x08
;
mouse_info
.
rlastx
=
mouse_info
.
x
;
mouse_info
.
rlasty
=
mouse_info
.
y
;
mouse_info
.
rbcount
++
;
break
;
case
WM_RBUTTONUP
:
mouse_info
.
but
&=
~
0x02
;
mask
|=
0x10
;
break
;
case
WM_MBUTTONDOWN
:
case
WM_MBUTTONDBLCLK
:
mouse_info
.
but
|=
0x04
;
mask
|=
0x20
;
break
;
case
WM_MBUTTONUP
:
mouse_info
.
but
&=
~
0x04
;
mask
|=
0x40
;
break
;
}
if
((
mask
&
mouse_info
.
callmask
)
&&
mouse_info
.
callback
)
{
MCALLDATA
*
data
=
calloc
(
1
,
sizeof
(
MCALLDATA
));
data
->
proc
=
mouse_info
.
callback
;
data
->
mask
=
mask
&
mouse_info
.
callmask
;
data
->
but
=
mouse_info
.
but
;
data
->
x
=
mouse_info
.
x
;
data
->
y
=
mouse_info
.
y
;
DOSVM_QueueEvent
(
-
1
,
DOS_PRIORITY_MOUSE
,
MouseRelay
,
data
);
}
QueueMouseRelay
(
LOWORD
(
lParam
)
*
SX
,
HIWORD
(
lParam
)
*
SY
,
mask
);
}
void
WINAPI
DOSVM_Int33Console
(
MOUSE_EVENT_RECORD
*
record
)
{
unsigned
Height
,
Width
;
WORD
mask
=
0
;
BOOL
newLeftButton
=
record
->
dwButtonState
&
FROM_LEFT_1ST_BUTTON_PRESSED
;
BOOL
oldLeftButton
=
mouse_info
.
but
&
0x01
;
BOOL
newRightButton
=
record
->
dwButtonState
&
RIGHTMOST_BUTTON_PRESSED
;
BOOL
oldRightButton
=
mouse_info
.
but
&
0x02
;
BOOL
newMiddleButton
=
record
->
dwButtonState
&
FROM_LEFT_2ND_BUTTON_PRESSED
;
BOOL
oldMiddleButton
=
mouse_info
.
but
&
0x04
;
if
(
newLeftButton
&&
!
oldLeftButton
)
mask
|=
0x02
;
else
if
(
!
newLeftButton
&&
oldLeftButton
)
mask
|=
0x04
;
if
(
newRightButton
&&
!
oldRightButton
)
mask
|=
0x08
;
else
if
(
!
newRightButton
&&
oldRightButton
)
mask
|=
0x10
;
if
(
newMiddleButton
&&
!
oldMiddleButton
)
mask
|=
0x20
;
else
if
(
!
newMiddleButton
&&
oldMiddleButton
)
mask
|=
0x40
;
VGA_GetAlphaMode
(
&
Width
,
&
Height
);
QueueMouseRelay
(
640
/
Width
*
record
->
dwMousePosition
.
X
,
200
/
Height
*
record
->
dwMousePosition
.
Y
,
mask
);
}
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