Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 474dcb5c authored by Jeff Brown's avatar Jeff Brown
Browse files

Add support for disabling pointer gestures.

Made it possible for individual windows to disable pointer gestures
while the window has focus using a private API.

Cleaned up the InputReader configuration code to enable in-place
reconfiguration of input devices without having to reopen them all.
This change makes changing the pointer speed somewhat nicer since the
pointer doesn't jump back to the origin after each change.

Change-Id: I9727419c2f4cb39e16acb4b15fd7fd84526b1239
parent 93fa9b30
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -1004,6 +1004,23 @@ public interface WindowManager extends ViewManager {
         */
        public boolean hasSystemUiListeners;

        /**
         * When this window has focus, disable touch pad pointer gesture processing.
         * The window will receive raw position updates from the touch pad instead
         * of pointer movements and synthetic touch events.
         *
         * @hide
         */
        public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;

        /**
         * Control special features of the input subsystem.
         *
         * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES
         * @hide
         */
        public int inputFeatures;

        public LayoutParams() {
            super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            type = TYPE_APPLICATION;
@@ -1086,6 +1103,7 @@ public interface WindowManager extends ViewManager {
            out.writeInt(systemUiVisibility);
            out.writeInt(subtreeSystemUiVisibility);
            out.writeInt(hasSystemUiListeners ? 1 : 0);
            out.writeInt(inputFeatures);
        }
        
        public static final Parcelable.Creator<LayoutParams> CREATOR
@@ -1124,6 +1142,7 @@ public interface WindowManager extends ViewManager {
            systemUiVisibility = in.readInt();
            subtreeSystemUiVisibility = in.readInt();
            hasSystemUiListeners = in.readInt() != 0;
            inputFeatures = in.readInt();
        }
    
        @SuppressWarnings({"PointlessBitwiseExpression"})
@@ -1145,6 +1164,8 @@ public interface WindowManager extends ViewManager {
        public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<13;
        /** {@hide} */
        public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14;
        /** {@hide} */
        public static final int INPUT_FEATURES_CHANGED = 1<<15;
    
        // internal buffer to backup/restore parameters under compatibility mode.
        private int[] mCompatibilityParamsBackup = null;
@@ -1256,6 +1277,11 @@ public interface WindowManager extends ViewManager {
                changes |= SYSTEM_UI_LISTENER_CHANGED;
            }

            if (inputFeatures != o.inputFeatures) {
                inputFeatures = o.inputFeatures;
                changes |= INPUT_FEATURES_CHANGED;
            }

            return changes;
        }
    
@@ -1340,6 +1366,7 @@ public interface WindowManager extends ViewManager {
                sb.append(" sysuil=");
                sb.append(hasSystemUiListeners);
            }
            sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
            sb.append('}');
            return sb.toString();
        }
+1 −0
Original line number Diff line number Diff line
@@ -3395,6 +3395,7 @@ void InputDispatcher::dumpDispatchStateLocked(String8& dump) {
                    window.frameRight, window.frameBottom,
                    window.scaleFactor);
            dumpRegion(dump, window.touchableRegion);
            dump.appendFormat(", inputFeatures=0x%08x", window.inputFeatures);
            dump.appendFormat(", ownerPid=%d, ownerUid=%d, dispatchingTimeout=%0.3fms\n",
                    window.ownerPid, window.ownerUid,
                    window.dispatchingTimeout / 1000000.0);
+254 −201

File changed.

Preview size limit exceeded, changes collapsed.

+30 −15

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ struct InputWindow {
        LAST_SYSTEM_WINDOW      = 2999,
    };

    enum {
        INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES = 0x00000001,
    };

    sp<InputWindowHandle> inputWindowHandle;
    sp<InputChannel> inputChannel;
    String8 name;
@@ -147,6 +151,7 @@ struct InputWindow {
    int32_t layer;
    int32_t ownerPid;
    int32_t ownerUid;
    int32_t inputFeatures;

    bool touchableRegionContainsPoint(int32_t x, int32_t y) const;
    bool frameContainsPoint(int32_t x, int32_t y) const;
Loading