Changeset c78ef7c


Ignore:
Timestamp:
07/10/14 13:26:01 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2, releng/10.2, stable/10
Children:
199f499
Parents:
f912f51
Message:

Fix the issue with menu's showing up on the screen when the toolbar is vertical (the X11 screen reservation function also needed to be vertical-toolbar aware in libLumina).
ALso clean up the general system tray appearance, and add a new virtual function for panel plugins to detect when the toolbar orientation might have changed and update appropriately. The system tray uses this function now (and it works really well), but the rest of the plugins need to add this functionality as well - otherwise sizes and such get all screwed up when switching between horizontal/vertical.

Location:
lumina
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lumina/libLumina/LuminaX11.cpp

    rbc4f0662 rc78ef7c  
    262262 
    263263// ===== ReservePanelLocation() ===== 
    264 void LX11::ReservePanelLocation(WId win, int xstart, int ystart, int width, int height){ 
     264void LX11::ReservePanelLocation(WId win, int xstart, int ystart, int width, int height, QString loc){ 
    265265  unsigned long strut[12]; 
    266266  for(int i=0; i<12; i++){ strut[i] = 0; } //initialize it to all zeros 
    267   if(ystart==0){ 
    268     //top 
     267  if(loc=="top"){ 
     268    //top of screen 
    269269    strut[2] = height; //top width 
    270270    strut[8] = xstart; //top x start 
    271271    strut[9] = xstart+width; //top x end 
    272   }else{ 
    273     //bottom 
     272  }else if(loc=="bottom"){ 
     273    //bottom of screen 
    274274    strut[3] = height; //bottom width 
    275275    strut[10] = xstart; //bottom x start 
    276276    strut[11] = xstart+width; //bottom x end 
     277  }else if(loc=="left"){ 
     278    strut[0] = width; 
     279    strut[4]=ystart; 
     280    strut[5]=ystart+height; 
     281  }else{ //right 
     282    strut[1] = width; 
     283    strut[6]=ystart; 
     284    strut[7]=ystart+height;        
    277285  } 
    278286  Display *disp = QX11Info::display(); 
  • lumina/libLumina/LuminaX11.h

    rbc4f0662 rc78ef7c  
    6363        static void RestoreWindow(WId);         // Restore (non-iconify) the Window 
    6464        static void ActivateWindow(WId);                // Make the window active; 
    65         static void ReservePanelLocation(WId win, int xstart, int ystart, int width, int height); 
     65        static void ReservePanelLocation(WId win, int xstart, int ystart, int width, int height, QString loc); //loc=[top,bottom,left,right] 
    6666        static void SetAsSticky(WId win); 
    6767        static void SetAsPanel(WId win); 
  • lumina/lumina-desktop/LPanel.cpp

    rf912f51 rc78ef7c  
    7474    this->setMaximumSize(sz); 
    7575    this->setGeometry(xoffset,0,xwid, ht ); 
    76     LX11::ReservePanelLocation(this->winId(), xoffset, 0, this->width(), ht); 
     76    LX11::ReservePanelLocation(this->winId(), xoffset, 0, this->width(), ht, "top"); 
    7777  }else if(loc=="bottom"){ //bottom of screen 
    7878    QSize sz = QSize(xwid, ht); 
     
    8080    this->setMaximumSize(sz); 
    8181    this->setGeometry(xoffset,xhi-ht,xwid, ht ); 
    82     LX11::ReservePanelLocation(this->winId(), xoffset, xhi-ht, this->width(), ht); 
     82    LX11::ReservePanelLocation(this->winId(), xoffset, xhi-ht, this->width(), ht, "bottom"); 
    8383  }else if(loc=="left"){ //left side of screen 
    8484    QSize sz = QSize(ht, xhi); 
     
    8686    this->setMaximumSize(sz); 
    8787    this->setGeometry(xoffset,0, ht, xhi); 
    88     LX11::ReservePanelLocation(this->winId(), xoffset, 0, ht, xhi); 
     88    LX11::ReservePanelLocation(this->winId(), xoffset, 0, ht, xhi, "left"); 
    8989  }else{ //right side of screen 
    9090    QSize sz = QSize(ht, xhi); 
     
    9292    this->setMaximumSize(sz); 
    9393    this->setGeometry(xoffset+xwid-ht,0,ht, xhi); 
    94     LX11::ReservePanelLocation(this->winId(), xoffset+xwid-ht, 0, ht, xhi);        
     94    LX11::ReservePanelLocation(this->winId(), xoffset+xwid-ht, 0, ht, xhi, "right");       
    9595  } 
    9696  //Now update the appearance of the toolbar 
     
    125125        if(horizontal){PLUGINS[p]->layout()->setDirection(QBoxLayout::LeftToRight); } 
    126126        else{ PLUGINS[p]->layout()->setDirection(QBoxLayout::TopToBottom); } 
     127        QTimer::singleShot(0,PLUGINS[p], SLOT( OrientationChange() ) ); 
    127128        //Now check the location of the plugin in the panel 
    128129        if(p!=i){ //wrong place in the panel 
  • lumina/lumina-desktop/panel-plugins/LPPlugin.h

    rf912f51 rc78ef7c  
    5656            //This is where all the visuals are set if using Theme-dependant icons. 
    5757        } 
     58        virtual void OrientationChange(){ 
     59          //This needs to be re-implemented in the subclasses plugin 
     60            //This is where any horizontal/vertical orientations can be changed appropriately            
     61        } 
    5862         
    5963}; 
  • lumina/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp

    rf912f51 rc78ef7c  
    88 
    99LSysTray::LSysTray(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ 
    10   //if(horizontal){ this->layout()->setAlignment(Qt::AlignRight | Qt::AlignVCenter); } 
    11   //else{ this->layout()->setAlignment(Qt::AlignHCenter | Qt::AlignTop); } 
    12   this->layout()->setAlignment(Qt::AlignCenter); 
    13   this->setStyleSheet("LPPlugin{ background: black; border: 1px solid grey; border-radius: 3px; }"); 
     10  frame = new QFrame(this); 
     11  frame->setContentsMargins(0,0,0,0); 
     12  frame->setStyleSheet("QFrame{ background: black; border: 1px solid grey; border-radius: 5px; }"); 
     13  LI = new QBoxLayout( this->layout()->direction(), this); 
     14    frame->setLayout(LI); 
     15    LI->setAlignment(Qt::AlignCenter); 
     16    LI->setSpacing(1); 
     17    LI->setContentsMargins(0,0,0,0); 
     18  this->layout()->addWidget(frame); 
    1419  this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
    15   this->layout()->setSpacing(0); 
    1620  isRunning = false; 
    1721  start(); 
     
    6367      connect(cont, SIGNAL(AppAttached()), this, SLOT(updateStatus()) ); 
    6468      trayIcons << cont; 
    65       this->layout()->addWidget(cont); 
     69      LI->addWidget(cont); 
    6670      if(this->layout()->direction()==QBoxLayout::LeftToRight){ 
    67         cont->setSizeSquare(this->height()); //horizontal tray 
     71        cont->setSizeSquare(this->height()-2*frame->frameWidth()); //horizontal tray 
    6872        this->setMaximumSize( trayIcons.length()*this->height(), 10000); 
    6973      }else{ 
    70         cont->setSizeSquare(this->width()); //vertical tray 
     74        cont->setSizeSquare(this->width()-2*frame->frameWidth()); //vertical tray 
    7175        this->setMaximumSize(10000, trayIcons.length()*this->width()); 
    7276      } 
     
    7983  qDebug() << "System Tray: Client Attached"; 
    8084  this->layout()->update(); //make sure there is no blank space 
    81   qDebug() << " - Items:" << trayIcons.length(); 
     85  //qDebug() << " - Items:" << trayIcons.length(); 
    8286} 
    8387 
     
    8791      qDebug() << "System Tray: Removing icon"; 
    8892      TrayIcon *cont = trayIcons.takeAt(i); 
    89       this->layout()->removeWidget(cont); 
     93      LI->removeWidget(cont); 
    9094      delete cont; 
    9195    } 
     
    97101    this->setMaximumSize(10000, trayIcons.length()*this->width()); 
    98102  } 
    99   this->layout()->update(); //update the layout (no gaps) 
     103  LI->update(); //update the layout (no gaps) 
    100104  this->update();        
    101105} 
  • lumina/lumina-desktop/panel-plugins/systemtray/LSysTray.h

    rf912f51 rc78ef7c  
    3232        bool isRunning; 
    3333        QList<TrayIcon*> trayIcons; 
    34          
    35          
     34        QFrame *frame; 
     35        QBoxLayout *LI; //layout items 
    3636         
    3737private slots: 
     
    3939        void updateStatus(); 
    4040        void trayAppClosed(); 
    41          
     41 
     42public slots: 
     43        virtual void OrientationChange(){ 
     44           //make sure the internal layout has the same orientation as the main widget 
     45           LI->setDirection( this->layout()->direction() ); 
     46           //Re-adjust the maximum widget size 
     47          if(this->layout()->direction()==QBoxLayout::LeftToRight){ 
     48            this->setMaximumSize( trayIcons.length()*this->height(), 10000); 
     49          }else{ 
     50            this->setMaximumSize(10000, trayIcons.length()*this->width()); 
     51          } 
     52        } 
    4253}; 
    4354 
Note: See TracChangeset for help on using the changeset viewer.