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
40bbe3da
Commit
40bbe3da
authored
Nov 25, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Nov 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Process WM_CHAR instead of WM_KEYDOWN for numbers in datetime.
parent
93aed4b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
77 deletions
+88
-77
datetime.c
dlls/comctl32/datetime.c
+88
-77
No files found.
dlls/comctl32/datetime.c
View file @
40bbe3da
...
...
@@ -902,83 +902,6 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode)
FIXME
(
"Callbacks not implemented yet
\n
"
);
}
if
(
vkCode
>=
'0'
&&
vkCode
<=
'9'
)
{
/* this is a somewhat simplified version of what Windows does */
SYSTEMTIME
*
date
=
&
infoPtr
->
date
;
switch
(
infoPtr
->
fieldspec
[
fieldNum
])
{
case
ONEDIGITYEAR
:
case
TWODIGITYEAR
:
date
->
wYear
=
date
->
wYear
-
(
date
->
wYear
%
100
)
+
(
date
->
wYear
%
10
)
*
10
+
(
vkCode
-
'0'
);
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
INVALIDFULLYEAR
:
case
FULLYEAR
:
date
->
wYear
=
(
date
->
wYear
%
1000
)
*
10
+
(
vkCode
-
'0'
);
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMONTH
:
case
TWODIGITMONTH
:
if
((
date
->
wMonth
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wMonth
=
vkCode
-
'0'
;
else
date
->
wMonth
=
(
date
->
wMonth
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITDAY
:
case
TWODIGITDAY
:
/* probably better checking here would help */
if
((
date
->
wDay
%
10
)
>=
3
&&
(
vkCode
-
'0'
)
>
1
)
date
->
wDay
=
vkCode
-
'0'
;
else
date
->
wDay
=
(
date
->
wDay
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT12HOUR
:
case
TWODIGIT12HOUR
:
if
((
date
->
wHour
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT24HOUR
:
case
TWODIGIT24HOUR
:
if
((
date
->
wHour
%
10
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
else
if
((
date
->
wHour
%
10
)
==
2
&&
(
vkCode
-
'0'
)
>
3
)
date
->
wHour
=
vkCode
-
'0'
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMINUTE
:
case
TWODIGITMINUTE
:
if
((
date
->
wMinute
%
10
)
>
5
)
date
->
wMinute
=
vkCode
-
'0'
;
else
date
->
wMinute
=
(
date
->
wMinute
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITSECOND
:
case
TWODIGITSECOND
:
if
((
date
->
wSecond
%
10
)
>
5
)
date
->
wSecond
=
vkCode
-
'0'
;
else
date
->
wSecond
=
(
date
->
wSecond
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
}
}
switch
(
vkCode
)
{
case
VK_ADD
:
case
VK_UP
:
...
...
@@ -1026,6 +949,91 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode)
static
LRESULT
DATETIME_Char
(
DATETIME_INFO
*
infoPtr
,
WPARAM
vkCode
,
LPARAM
keyData
)
{
int
fieldNum
=
infoPtr
->
select
&
DTHT_DATEFIELD
;
if
(
vkCode
>=
'0'
&&
vkCode
<=
'9'
)
{
/* this is a somewhat simplified version of what Windows does */
SYSTEMTIME
*
date
=
&
infoPtr
->
date
;
switch
(
infoPtr
->
fieldspec
[
fieldNum
])
{
case
ONEDIGITYEAR
:
case
TWODIGITYEAR
:
date
->
wYear
=
date
->
wYear
-
(
date
->
wYear
%
100
)
+
(
date
->
wYear
%
10
)
*
10
+
(
vkCode
-
'0'
);
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
INVALIDFULLYEAR
:
case
FULLYEAR
:
date
->
wYear
=
(
date
->
wYear
%
1000
)
*
10
+
(
vkCode
-
'0'
);
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMONTH
:
case
TWODIGITMONTH
:
if
((
date
->
wMonth
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wMonth
=
vkCode
-
'0'
;
else
date
->
wMonth
=
(
date
->
wMonth
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITDAY
:
case
TWODIGITDAY
:
/* probably better checking here would help */
if
((
date
->
wDay
%
10
)
>=
3
&&
(
vkCode
-
'0'
)
>
1
)
date
->
wDay
=
vkCode
-
'0'
;
else
date
->
wDay
=
(
date
->
wDay
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT12HOUR
:
case
TWODIGIT12HOUR
:
if
((
date
->
wHour
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT24HOUR
:
case
TWODIGIT24HOUR
:
if
((
date
->
wHour
%
10
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
else
if
((
date
->
wHour
%
10
)
==
2
&&
(
vkCode
-
'0'
)
>
3
)
date
->
wHour
=
vkCode
-
'0'
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMINUTE
:
case
TWODIGITMINUTE
:
if
((
date
->
wMinute
%
10
)
>
5
)
date
->
wMinute
=
vkCode
-
'0'
;
else
date
->
wMinute
=
(
date
->
wMinute
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITSECOND
:
case
TWODIGITSECOND
:
if
((
date
->
wSecond
%
10
)
>
5
)
date
->
wSecond
=
vkCode
-
'0'
;
else
date
->
wSecond
=
(
date
->
wSecond
%
10
)
*
10
+
vkCode
-
'0'
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
}
}
return
0
;
}
static
LRESULT
DATETIME_VScroll
(
DATETIME_INFO
*
infoPtr
,
WORD
wScroll
)
{
int
fieldNum
=
infoPtr
->
select
&
DTHT_DATEFIELD
;
...
...
@@ -1341,6 +1349,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case
WM_KEYDOWN
:
return
DATETIME_KeyDown
(
infoPtr
,
wParam
);
case
WM_CHAR
:
return
DATETIME_Char
(
infoPtr
,
wParam
,
lParam
);
case
WM_KILLFOCUS
:
return
DATETIME_KillFocus
(
infoPtr
,
(
HWND
)
wParam
);
...
...
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