Closed
Bug 503042
Opened 16 years ago
Closed 16 years ago
Implement a way to detect a touch enabled device
Categories
(Core :: Widget: Win32, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9.2b1
People
(Reporter: Felipe, Assigned: Felipe)
References
(Depends on 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(3 files, 4 obsolete files)
493 bytes,
text/html
|
Details | |
8.00 KB,
patch
|
vlad
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
7.99 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
Build Identifier:
To be able to tailor the behavior and appearance of Firefox for a touch based interactions (e.g. increase target area or the size of elements), we need to implement a way to detect if we're running on a touch enabled device so we can apply certain modifications only under this condition.
The initial approach will be to create to create a new boolean flag for the :-moz-system-metric pseudo CSS selector, for example :-moz-system-metric(windows-touch).
Patch coming.
Reproducible: Always
Assignee | ||
Comment 1•16 years ago
|
||
This patch seems to work. Gonna test more soon. It still needs more considerations on some parts, and some polish here and there that I'll be doing soon but I think that it should already be valuable to post it here in the current state.
(To create it I followed the same structure from the patch on bug 426660)
Assignee | ||
Comment 2•16 years ago
|
||
A simple test case to check if the detection is working via the :-moz-system-metric(windows-touch) CSS selector
![]() |
||
Comment 3•16 years ago
|
||
I suggest we use touch or perhaps touch-device instead of windows-touch so other platforms can implement similar functionality.
![]() |
||
Comment 4•16 years ago
|
||
+/*
+ * Gesture System Metrics
+ */
+#define SM_DIGITIZER 94
I'd move these up to the top of the header. Also are these defined in the win7 sdk? If so, you'll also want to ifndef the block so that when these defines are exposed through the sdk, this won't break the build.
![]() |
||
Updated•16 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
Assignee | ||
Comment 5•16 years ago
|
||
New version addressing comments above. I've changed the token from windows-touch to touch-enabled. Also made the #defines conditional to an #ifdef
No review request yet because we're figuring out if there's a better way to detect a touch device (because this one detects the presence of the input service, not taking into account if there's actually such device attached)
Assignee | ||
Comment 6•16 years ago
|
||
Updating test case to reflect new token name
Attachment #387421 -
Attachment is obsolete: true
Comment 7•16 years ago
|
||
Is there any way to get this working on non-windows based touchscreen devices? Fennec would like some of these features too.
![]() |
||
Comment 8•16 years ago
|
||
I suspect it is but I also suspect it would need to be a separate implementation since this is for Win7 touch. The way this is implemented should definitely take into account other detection routines such as the ones needed for Fennec
Assignee | ||
Comment 9•16 years ago
|
||
Adding new detection routines here should be straightforward. Note that this detection is currently only for setting the CSS selector though. We may also want to change from a boolean value to a integer value on return so we can detect different cases if that's needed (different devices or different forms of input for example)
Assignee | ||
Comment 10•16 years ago
|
||
Small update on the patch, removing a leftover printf and updating an #ifdef with Robert's suggestion.
Now we've confirmed that the API we are using to detect the touch device is indeed the correct, and the problem we saw before was due to a non plug-and-play driver, so this patch should be correct by now.
Attachment #387997 -
Attachment is obsolete: true
Assignee | ||
Comment 11•16 years ago
|
||
Oops sorry for the email, forgot to add that this patch doesn't consider a pen-only device as touch enabled. It only considers if there is actual finger touch support*. We can easily change that if wanted. This was mainly because the pen just simulates a mouse, while hand touch brings other interaction considerations.
* Checking if NID_INTERNAL_TOUCH or NID_EXTERNAL_TOUCH is reported. To add pen we would just check NID_INTERNAL_PEN or NID_EXTERNAL_PEN as well
Comment 12•16 years ago
|
||
>Oops sorry for the email, forgot to add that this patch doesn't consider a
>pen-only device as touch enabled. It only considers if there is actual finger
>touch support
yeah, I think this makes sense, especially if we start to make targets finger sized based on the physical size of the screen (assuming we can get this information from the system).
Assignee | ||
Comment 13•16 years ago
|
||
Comment on attachment 389056 [details] [diff] [review]
:-moz-system-metric(touch-enabled) rev3
Vlad, you were the reviewer for a similar patch which I took as a base for this one, so I'm requesting review here as well.
Attachment #389056 -
Flags: review?(vladimir)
Attachment #389056 -
Flags: review?(vladimir) → review+
Assignee | ||
Updated•16 years ago
|
Attachment #389056 -
Flags: superreview?(dbaron)
Assignee | ||
Comment 14•16 years ago
|
||
Comment on attachment 389056 [details] [diff] [review]
:-moz-system-metric(touch-enabled) rev3
David, this adds supports for :-moz-system-metric(touch-enabled), which we would like to use to style things differently on devices with touch support (currently for win7 only)
Comment on attachment 389056 [details] [diff] [review]
:-moz-system-metric(touch-enabled) rev3
>+/*
>+ * Gesture System Metrics
>+ */
>+#ifndef SM_DIGITIZER
>+#define SM_DIGITIZER 94
>+#define TABLET_CONFIG_NONE 0x00000000
>+#define NID_INTEGRATED_TOUCH 0x00000001
>+#define NID_EXTERNAL_TOUCH 0x00000002
>+#define NID_INTEGRATED_PEN 0x00000004
>+#define NID_EXTERNAL_PEN 0x00000008
>+#define NID_MULTI_INPUT 0x00000040
>+#define NID_READY 0x00000080
>+#endif
It might be good to have a comment saying where these constants come from.
Also, given this has #define SM_DIGITIZER, does the part in nsLookAndFeel.cpp need the #ifdef? It seems that by that point it will always be defined.
sr=dbaron. Sorry for the delay.
Attachment #389056 -
Flags: superreview?(dbaron) → superreview+
Assignee | ||
Comment 16•16 years ago
|
||
Assignee | ||
Comment 17•16 years ago
|
||
sorry for previous attachment, I hit Enter before filing the details
> Also, given this has #define SM_DIGITIZER, does the part in nsLookAndFeel.cpp
> need the #ifdef? It seems that by that point it will always be defined.
That was there because after bug 506197 gets done SM_DIGITIZER won't be manually defined at the .h anymore. Talking with Rob Strong I'm changing this for #ifndef WINCE which will work better
Only diff between these patches is at widget/src/windows/nsLookAndFeel.cpp:
-#if defined(SM_DIGITIZER)
+#ifndef WINCE
Attachment #393635 -
Attachment is obsolete: true
![]() |
||
Comment 18•16 years ago
|
||
Pushed to mozilla-central
http://hg.mozilla.org/mozilla-central/rev/f82a16fa0008
![]() |
||
Updated•16 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Keywords: dev-doc-needed
Target Milestone: --- → mozilla1.9.2b1
Comment 19•16 years ago
|
||
Keywords: dev-doc-needed → dev-doc-complete
We should not be evangelizing -moz-system-metric for use on Web sites. A media query value is the way to go for Web content.
Comment 21•15 years ago
|
||
Is there a media query value for this?
with my CSS WG co-chair hat on, I just do not understand why this became a
functional pseudo-class and not an extension to CSS Media Queries.
And I really regret it did not become a Media Query **before** the article
on hacks.mozilla.org.
IMHO, this should have never landed as a pseudo-class...
Comment 23•15 years ago
|
||
How hard would it be to add a media query for it? I don't know the process behind making that happen, but the sooner it happens, the better for everyone.
Assignee | ||
Comment 24•15 years ago
|
||
This was originally implemented to make adjustments on the Firefox chrome only (the changes made on bug 503889).
The fact that it happily works on webpages too is how it got documented, but it's still a -moz extension. I've filed bug 522149 to make this a media query.
Comment 25•15 years ago
|
||
-moz-system-metric(touch-enabled) reports wrong. I use a Dell XT2 Tablet and
have the touch input disabled (Control Panel, Pen and Touch, Touch, "Use your
finger as an input device" unchecked), so only the pen can be used.
Second the property should be monitor-dependent. Only the laptops integrated
monitor is touch/pen capable, not an external monitor.
This property should be divided into touch-enabled, pen-enabled, etc...?
Comment 26•15 years ago
|
||
(In reply to comment #25)
-> Bug 541242
You need to log in
before you can comment on or make changes to this bug.
Description
•