Closed
Bug 795832
Opened 13 years ago
Closed 12 years ago
Implement synthesized input events in metro widget
Categories
(Core :: Widget: Win32, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jimm, Assigned: TimAbraldes)
Details
(Whiteboard: [metro-mvp][completed-elm][leave open])
Attachments
(3 files, 3 obsolete files)
6.12 KB,
patch
|
Details | Diff | Splinter Review | |
15.94 KB,
patch
|
TimAbraldes
:
review+
|
Details | Diff | Splinter Review |
777 bytes,
patch
|
jimm
:
review+
TimAbraldes
:
checkin+
|
Details | Diff | Splinter Review |
http://mxr.mozilla.org/mozilla-central/source/widget/nsIWidget.h#1300
We need these to build up a set of tests.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → tabraldes
Assignee | ||
Comment 2•13 years ago
|
||
This patch implements synthesized mouse, keyboard, and scroll events. I've tested this patch by modifying browser.js to call `nsIDOMWindowUtils.sendNativeMouseEvent`, `nsIDOMWindowUtils.sendNativeKeyEvent`, and `nsIDOMWindowUtils.sendNativeMouseScrollEvent`. Those functions in turn call the ones implemented in this patch.
Attachment #677477 -
Flags: review?(jmathies)
![]() |
Reporter | |
Comment 3•13 years ago
|
||
Comment on attachment 677477 [details] [diff] [review]
Patch
Review of attachment 677477 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/windows/winrt/MetroWidget.cpp
@@ +376,5 @@
> +{
> + Log(L"ENTERED SynthesizeNativeKeyEvent\n");
> +
> + // Source: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646271%28v=vs.85%29.aspx
> + NS_ENSURE_ARG_RANGE(aNativeKeyCode, 1, 254);
nit - add a comment explaining these constants rather than a link (or have both).
@@ +539,5 @@
> + // inputs[len-1]: modifier key (e.g. shift, ctrl, etc) up
> + uint32_t const len = keySequence.Length() * 2 + 1;
> + INPUT* inputs = new INPUT[len];
> + memset(inputs, 0, len * sizeof(INPUT));
> + for (uint32_t i = 0; i < keySequence.Length(); ++i) {
You seem to be reusing this block of code in each call, can we split this out into a utility function along with it's comment block?
@@ +559,5 @@
> + // processed by the time we leave this function, so we have to manually
> + // pump them here.
> + Log(L" Waiting for input messages to clear\n");
> + MSG msg;
> + while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_INPUT)) {
ditto with this block.
I'm a little concerned about using this since we won't be going through the winrt dispatcher, but I think we can leave it be and address later if any problems crop up.
Attachment #677477 -
Flags: review?(jmathies) → review+
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to Jim Mathies [:jimm] from comment #3)
> Comment on attachment 677477 [details] [diff] [review]
> Patch
>
> Review of attachment 677477 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: widget/windows/winrt/MetroWidget.cpp
> @@ +376,5 @@
> > +{
> > + Log(L"ENTERED SynthesizeNativeKeyEvent\n");
> > +
> > + // Source: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646271%28v=vs.85%29.aspx
> > + NS_ENSURE_ARG_RANGE(aNativeKeyCode, 1, 254);
>
> nit - add a comment explaining these constants rather than a link (or have
> both).
Added a comment.
> @@ +539,5 @@
> > + // inputs[len-1]: modifier key (e.g. shift, ctrl, etc) up
> > + uint32_t const len = keySequence.Length() * 2 + 1;
> > + INPUT* inputs = new INPUT[len];
> > + memset(inputs, 0, len * sizeof(INPUT));
> > + for (uint32_t i = 0; i < keySequence.Length(); ++i) {
>
> You seem to be reusing this block of code in each call, can we split this
> out into a utility function along with it's comment block?
Pulled this out into a separate function.
> @@ +559,5 @@
> > + // processed by the time we leave this function, so we have to manually
> > + // pump them here.
> > + Log(L" Waiting for input messages to clear\n");
> > + MSG msg;
> > + while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_INPUT)) {
>
> ditto with this block.
Pulled this out into the new function.
> I'm a little concerned about using this since we won't be going through the
> winrt dispatcher, but I think we can leave it be and address later if any
> problems crop up.
Agreed; let's see if any problems come up once we start using this functionality in our tests.
Attachment #677477 -
Attachment is obsolete: true
Attachment #678444 -
Flags: review+
Assignee | ||
Comment 5•13 years ago
|
||
This is the patch that I used during testing. At various points I had it use additional synthesized input events (right-click to bring up the url bar, left click to click in the url bar, etc).
An issue I've discovered is that synthesizing "ctrl+f" and "ctrl+l" do not have their intended effects. The keys are definitely being pressed, but for a reason I haven't yet been able to track down, synthesizing "ctrl+l" does not cause focus to be set in the URL bar, and synthesizing "ctrl+f" does not cause "find in page" to appear.
Everything else I've tested does work:
Synthesizing right-clicks to make the context menu and tab bar appear
Synthesizing left clicks in the URL bar to focus it
Synthesizing key presses, including capital letters by passing `nsIWidget::SHIFT_L` and `nsIWidget::SHIFT_R` as flags
Closing the browser by synthesizing "alt+f4"
Scrolling a page with synthesized scroll events
Assignee | ||
Comment 6•13 years ago
|
||
I updated the patch to remove the use of `::SetCursor` and instead move the mouse to the desired location with additional inputs to `::SendInput`. Also updated some logging.
Attachment #678444 -
Attachment is obsolete: true
Attachment #678514 -
Flags: review+
Assignee | ||
Comment 7•13 years ago
|
||
Status: NEW → ASSIGNED
Whiteboard: metro-mvp → [metro-mvp][completed-elm]
Assignee | ||
Comment 8•13 years ago
|
||
This was backed out due to bustage:
https://hg.mozilla.org/projects/elm/rev/cf4c200f5ccf
And re-submitted with a bustage fix:
https://hg.mozilla.org/projects/elm/rev/1b7a541acf76
![]() |
Reporter | |
Comment 9•13 years ago
|
||
Lets get the nsWindowDefs.h change over on mc. The top level widget changes have merged so this shows up in an mc-elm diff.
Assignee | ||
Comment 10•13 years ago
|
||
I'm building this locally as a sanity check, and requesting review so that it lands with an r+ :)
Attachment #680690 -
Flags: review?(jmathies)
Assignee | ||
Comment 11•13 years ago
|
||
Updating patch - a misc other change crept into the previous version
Attachment #680690 -
Attachment is obsolete: true
Attachment #680690 -
Flags: review?(jmathies)
Attachment #680691 -
Flags: review?(jmathies)
![]() |
Reporter | |
Comment 12•13 years ago
|
||
Comment on attachment 680691 [details] [diff] [review]
nsWindowDefs.h patch for m-c
Looks ok to me.
Attachment #680691 -
Flags: review?(jmathies) → review+
Assignee | ||
Comment 13•13 years ago
|
||
Comment on attachment 680691 [details] [diff] [review]
nsWindowDefs.h patch for m-c
https://hg.mozilla.org/mozilla-central/rev/303a14307763
Attachment #680691 -
Flags: checkin+
Assignee | ||
Updated•13 years ago
|
Whiteboard: [metro-mvp][completed-elm] → [metro-mvp][completed-elm][leave open]
Assignee | ||
Comment 14•12 years ago
|
||
Marking my [completed-elm] bugs as resolved
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
OS: Windows 8 Metro → Windows 8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•