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 mStylusPalette->show(); // always show stylus palette at startup
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
mKeyboardPalette = UBKeyboardPalette::create(mContainer); mKeyboardPalette = UBKeyboardPalette::create(0);
mZoomPalette = new UBZoomPalette(mContainer); mZoomPalette = new UBZoomPalette(mContainer);

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

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

@ -10,7 +10,7 @@
UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent) 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) , mIsMoving(false)
, mCustomPosition(false) , mCustomPosition(false)
, mCanBeMinimized(false) , mCanBeMinimized(false)
@ -27,7 +27,9 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
{ {
// standalone window // standalone window
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
UBPlatformUtils::disableShadow(this); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
setAttribute(Qt::WA_MacNonActivatingToolWindow);
setAttribute(Qt::WA_MacNoShadow);
} }
mBackgroundBrush = QBrush(UBSettings::paletteColor); mBackgroundBrush = QBrush(UBSettings::paletteColor);

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

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

Loading…
Cancel
Save