Adapt keyboard palette using widget attribute WA_MacNonActivatingToolWindow

Only have one instance of the virtual keyboard palette.
preferencesAboutTextFull
Cédric Luthi 14 years ago
parent e90d2d3338
commit ab0658ee60
  1. 2
      src/board/UBBoardPaletteManager.cpp
  2. 30
      src/desktop/UBDesktopAnnotationController.cpp
  3. 2
      src/desktop/UBDesktopAnnotationController.h
  4. 6
      src/gui/UBFloatingPalette.cpp
  5. 2
      src/gui/UBFloatingPalette.h
  6. 4
      src/gui/UBKeyboardPalette.cpp

@ -123,7 +123,7 @@ void UBBoardPaletteManager::setupPalettes()
mStylusPalette->show(); // always show stylus palette at startup
if (UBPlatformUtils::hasVirtualKeyboard())
mKeyboardPalette = UBKeyboardPalette::create(mContainer);
mKeyboardPalette = UBKeyboardPalette::create(0);
mZoomPalette = new UBZoomPalette(mContainer);

@ -45,7 +45,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL)
, mKeyboardPalette(NULL)
, mLibPalette(NULL)
, mWindowPositionInitialized(0)
, mIsFullyTransparent(false)
@ -81,8 +80,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView);
connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(goToUniboard()));
//connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
connect(mDesktopPalette, SIGNAL(showVirtualKeyboard(bool)), this, SLOT(showKeyboard(bool)));
connect(mDesktopPalette, SIGNAL(customClick()), this, SLOT(customCapture()));
connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(windowCapture()));
connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture()));
@ -104,19 +101,12 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView);
mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView);
if (UBPlatformUtils::hasVirtualKeyboard())
{
mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView);
connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
}
mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopToolsPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopMarkerPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopEraserPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
if (mKeyboardPalette)
mKeyboardPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopToolsPalette->setVisible(UBApplication::mainWindow->actionDesktopTools->isChecked());
@ -129,7 +119,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopPenPalette->setVisible(false);
mDesktopMarkerPalette->setVisible(false);
mDesktopEraserPalette->setVisible(false);
if (mKeyboardPalette) mKeyboardPalette->setVisible(false);
connect(UBApplication::mainWindow->actionDesktopTools, SIGNAL(triggered(bool)), this, SLOT(desktopToolsActionToogled(bool)));
connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(eraseDesktopAnnotations()));
@ -161,11 +150,6 @@ UBDesktopAnnotationController::~UBDesktopAnnotationController()
delete mDesktopEraserPalette;
mDesktopEraserPalette = NULL;
}
if (NULL != mKeyboardPalette)
{
delete mKeyboardPalette;
mKeyboardPalette = NULL;
}
if(NULL != mLibPalette)
{
delete mLibPalette;
@ -309,11 +293,6 @@ void UBDesktopAnnotationController::showWindow()
//mDesktopPalette->move((desktopRect.right() - (mDesktopPalette->width() + 20)), desktopRect.top() + 150);
mDesktopPalette->move(5, desktopRect.top() + 150);
mKeyboardPalette->move(desktopRect.left() + (desktopRect.width() - mKeyboardPalette->width())/2,
desktopRect.top() + desktopRect.height() - mKeyboardPalette->height());
mKeyboardPalette->adjustSizeAndPosition();
mWindowPositionInitialized = true;
}
@ -389,15 +368,6 @@ void UBDesktopAnnotationController::goToUniboard()
}
void UBDesktopAnnotationController::showKeyboard(bool v)
{
if (mKeyboardPalette!=NULL)
{
mKeyboardPalette->setVisible(v);
}
}
void UBDesktopAnnotationController::customCapture()
{
mIsFullyTransparent = true;

@ -52,7 +52,6 @@ class UBDesktopAnnotationController : public QObject
void screenLayoutChanged();
void goToUniboard();
void showKeyboard(bool v);
void customCapture();
void windowCapture();
void screenCapture();
@ -103,7 +102,6 @@ class UBDesktopAnnotationController : public QObject
UBDesktopPenPalette* mDesktopPenPalette;
UBDesktopMarkerPalette* mDesktopMarkerPalette;
UBDesktopEraserPalette* mDesktopEraserPalette;
UBKeyboardPalette* mKeyboardPalette;
UBLibPalette* mLibPalette;

@ -10,7 +10,7 @@
UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)
: QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint))
, mIsMoving(false)
, mCustomPosition(false)
, mCanBeMinimized(false)
@ -27,7 +27,9 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
{
// standalone window
setAttribute(Qt::WA_TranslucentBackground);
UBPlatformUtils::disableShadow(this);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
setAttribute(Qt::WA_MacNonActivatingToolWindow);
setAttribute(Qt::WA_MacNoShadow);
}
mBackgroundBrush = QBrush(UBSettings::paletteColor);

@ -59,6 +59,7 @@ class UBFloatingPalette : public QWidget
static const int sLayoutSpacing = 15;
void moveInsideParent(const QPoint &position);
bool mCustomPosition;
bool mIsMoving;
private:
void removeAllAssociatedPalette();
@ -66,7 +67,6 @@ class UBFloatingPalette : public QWidget
QList<UBFloatingPalette*> mAssociatedPalette;
QPoint mDragPosition;
bool mIsMoving;
bool mCanBeMinimized;
eMinimizedLocation mMinimizedLocation;
Qt::Corner mDefaultPosition;

@ -195,9 +195,7 @@ void UBKeyboardPalette::enterEvent ( QEvent * )
void UBKeyboardPalette::leaveEvent ( QEvent * )
{
if (languagePopupActive)
return;
if (!keyboardActive)
if (languagePopupActive || !keyboardActive || mIsMoving)
return;
keyboardActive = false;

Loading…
Cancel
Save