forked from TigerVNC/tigervnc
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEMP: Basic sync of KeyboardMacOS.cxx
- Loading branch information
1 parent
972eb84
commit b2e6f67
Showing
6 changed files
with
576 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,61 @@ | ||
#ifndef X11KEYBOARDHANDLER_H | ||
#define X11KEYBOARDHANDLER_H | ||
/* Copyright 2011-2021 Pierre Ossman <[email protected]> for Cendio AB | ||
* | ||
* This is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this software; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
* USA. | ||
*/ | ||
|
||
#ifndef __KEYBOARDMACOS_H__ | ||
#define __KEYBOARDMACOS_H__ | ||
|
||
#include "Keyboard.h" | ||
|
||
class NSView; | ||
class NSCursor; | ||
#ifdef __OBJC__ | ||
@class NSEvent; | ||
@class NSString; | ||
#else | ||
class NSEvent; | ||
class NSString; | ||
#endif | ||
|
||
class KeyboardMacOS : public Keyboard | ||
{ | ||
class KeyboardMacOS : public Keyboard { | ||
public: | ||
KeyboardMacOS(KeyboardHandler* handler); | ||
virtual ~KeyboardMacOS(); | ||
|
||
bool handleEvent(const char* eventType, void* message) override; | ||
|
||
static bool isKeyboardSync(QByteArray const& eventType, void* message); | ||
|
||
unsigned getLEDState() override; | ||
void setLEDState(unsigned state) override; | ||
void grabKeyboard() override; | ||
void ungrabKeyboard() override; | ||
|
||
private: | ||
NSView* view; | ||
NSCursor* cursor; | ||
// Special helper on macOS | ||
static bool isKeyboardSync(const char* eventType, void* message); | ||
|
||
protected: | ||
bool isKeyboardEvent(const NSEvent* nsevent); | ||
bool isKeyPress(const NSEvent* nsevent); | ||
uint32_t translateSystemKeyCode(int systemKeyCode); | ||
unsigned getSystemKeyCode(const NSEvent* nsevent); | ||
|
||
NSString* keyTranslate(unsigned keyCode, unsigned modifierFlags); | ||
uint32_t translateEventKeysym(const NSEvent* nsevent); | ||
|
||
int openHID(unsigned int* ioc); | ||
int getModifierLockState(int modifier, bool* on); | ||
int setModifierLockState(int modifier, bool on); | ||
}; | ||
|
||
#endif // VNCMACVIEW_H | ||
#endif |
Oops, something went wrong.