| 2903 | } |
| 2904 | |
| 2905 | void Window::setVirtualKeyboardGeometry(const RectF &geo) |
| 2906 | { |
| 2907 | // No keyboard anymore |
| 2908 | if (geo.isEmpty() && !m_keyboardGeometryRestore.isEmpty()) { |
| 2909 | const RectF availableArea = workspace()->clientArea(MaximizeArea, this); |
| 2910 | RectF newWindowGeometry = (requestedMaximizeMode() & MaximizeHorizontal) ? availableArea : m_keyboardGeometryRestore; |
| 2911 | moveResize(newWindowGeometry); |
| 2912 | m_keyboardGeometryRestore = RectF(); |
| 2913 | } else if (geo.isEmpty()) { |
| 2914 | return; |
| 2915 | // The keyboard has just been opened (rather than resized) save window geometry for a restore |
| 2916 | } else if (m_keyboardGeometryRestore.isEmpty()) { |
| 2917 | m_keyboardGeometryRestore = moveResizeGeometry(); |
| 2918 | } |
| 2919 | |
| 2920 | m_virtualKeyboardGeometry = geo; |
| 2921 | |
| 2922 | // Don't resize Desktop and fullscreen windows |
| 2923 | if (isRequestedFullScreen() || isDesktop()) { |
| 2924 | return; |
| 2925 | } |
| 2926 | |
| 2927 | // If we want to overlay the vkbd over windows, don't resize them |
| 2928 | if (options->overlayVirtualKeyboardOnWindows()) { |
| 2929 | return; |
| 2930 | } |
| 2931 | |
| 2932 | if (!geo.intersects(m_keyboardGeometryRestore)) { |
| 2933 | return; |
| 2934 | } |
| 2935 | |
| 2936 | const RectF availableArea = workspace()->clientArea(MaximizeArea, this); |
| 2937 | RectF newWindowGeometry = (requestedMaximizeMode() & MaximizeHorizontal) ? availableArea : m_keyboardGeometryRestore; |
| 2938 | newWindowGeometry.setHeight(std::min(newWindowGeometry.height(), geo.top() - availableArea.top())); |
| 2939 | newWindowGeometry.moveTop(std::max(geo.top() - newWindowGeometry.height(), availableArea.top())); |
| 2940 | newWindowGeometry = newWindowGeometry.intersected(availableArea); |
| 2941 | moveResize(newWindowGeometry); |
| 2942 | } |
| 2943 | |
| 2944 | RectF Window::keyboardGeometryRestore() const |
| 2945 | { |