Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot switch layout by clicking layout icon using mouse button #671

Closed
nslynx opened this issue Nov 17, 2018 · 10 comments
Closed

Cannot switch layout by clicking layout icon using mouse button #671

nslynx opened this issue Nov 17, 2018 · 10 comments
Assignees

Comments

@nslynx
Copy link

nslynx commented Nov 17, 2018

Describe the bug

Cannot switch layout by clicking layout icon using mouse button

To Reproduce

  1. Start session
  2. Use shortcut to see layout switching icon
  3. Click it by mouse buttons
  4. No reaction

Expected behavior

Layouts must be switched by mouse button as it is done by using shortcut

deepin 15.8

@nslynx nslynx changed the title Cannot switch layout by clicking layout using mouse button Cannot switch layout by clicking layout icon using mouse button Nov 17, 2018
@listenerri
Copy link

That is not a bug.
The keyboard layout indicator does not support mouse events, do we need support it? @hualet

@hualet
Copy link
Contributor

hualet commented Nov 20, 2018

That is not a bug.
The keyboard layout indicator does not support mouse events, do we need support it? @hualet

It did support that long time ago until @justforlxz rewrote it.

@nslynx
Copy link
Author

nslynx commented Nov 20, 2018

I think, it should support mouse events, as it supports it in Plasma/Win7/Cinnamon etc, with
LMB: simple switching (the same as clicking shortcut)
RMB: small context menu with list of layouts and "settings" option.
@hualet @listenerri

@listenerri
Copy link

@tribunal2000
Ok, it will be fixed later

@listenerri
Copy link

@listenerri listenerri assigned liuwen123 and unassigned listenerri and justforlxz Mar 6, 2019
@liuwen123
Copy link

+1

deepin-gerrit pushed a commit to linuxdeepin/dde-dock that referenced this issue Mar 7, 2019
@nslynx
Copy link
Author

nslynx commented Mar 8, 2019

May be you should use button value like this?

(pseudo code, using my style (it looks lix mix of google and Qt style))
(May be I am wrong and should use sources to compile, but this is just a small suggestion)

void DBusAdaptors::onClicked(int button, int x, int y) {
  if (m_userLayoutList.size() < 2) 
      return;

  int oldLayoutIndex = newLayoutIndex = m_userLayoutList.indexOf(m_currentLayout); 
   switch (button)   {
     case LEFT_BUTTON:
     case SCROLL_DOWN:
          newLayoutIndex++;
       if (newLayoutIndex  >= m_userLayoutList.size())
          newLayoutIndex = 0;
       break;
     case SCROLL_UP:
       newLayoutIndex--;
       if (newLayoutIndex < 0)
       newLayoutIndex = m_userLayout.size() - 1;
       break;
      case RIGHT_BUTTON:
      case MIDDLE_BUTTON:
       if (m_menu) {
          m_menu->exec(QPoint(x, y));
          return;
       }
       break;
    default:
       break;
   }

  if (oldLayoutIndex != newLayoutIndex)
 {
    QString newLayout = m_userLayoutList.at(newLayoutIndex);
      m_keyboard->setCurrentLayout(newLayout);
       emit LayoutChanged (newLayout);
 }
}

Sorry, tabs and spaces of formatting code have lost :(

@hualet
Copy link
Contributor

hualet commented Mar 13, 2019

@tribunal2000 you can use ``` to quote your code.

@nslynx
Copy link
Author

nslynx commented Mar 13, 2019

Thank you 👍 Now looks much better

@liuwen123
Copy link

已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants