fixed: code was not gnuc 4.2 compatible

This commit is contained in:
Nick Bolton 2014-02-25 19:10:54 +00:00
parent a5d702c8b5
commit 228befdc2c
5 changed files with 86 additions and 81 deletions

View File

@ -155,4 +155,7 @@ enum {
kExitConfig = 4 // cannot read configuration kExitConfig = 4 // cannot read configuration
}; };
// gnu 4.6+ has pragma diagnostic push and tautological-compare
#define GNUC_46 defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#endif #endif

View File

@ -21,8 +21,10 @@
#include "CString.h" #include "CString.h"
#if __APPLE__ #if __APPLE__
# if GNUC_46
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtautological-compare" # pragma GCC diagnostic ignored "-Wtautological-compare"
# endif
# pragma GCC diagnostic ignored "-Wall" # pragma GCC diagnostic ignored "-Wall"
#endif #endif
@ -31,8 +33,10 @@
#include <cryptopp562/aes.h> #include <cryptopp562/aes.h>
#if __APPLE__ #if __APPLE__
# if GNUC_46
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
# endif # endif
#endif
//! Encapsulation of modes //! Encapsulation of modes
/*! /*!

View File

@ -22,7 +22,9 @@
#include "CCryptoMode.h" #include "CCryptoMode.h"
#if __APPLE__ #if __APPLE__
# if GNUC_46
# pragma GCC diagnostic push # pragma GCC diagnostic push
# endif
# pragma GCC diagnostic ignored "-Wall" # pragma GCC diagnostic ignored "-Wall"
#endif #endif
@ -30,8 +32,10 @@
#include <cryptopp562/sha.h> #include <cryptopp562/sha.h>
#if __APPLE__ #if __APPLE__
# if GNUC_46
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
# endif # endif
#endif
class CCryptoOptions; class CCryptoOptions;

View File

@ -61,6 +61,12 @@ enum {
kSynergyMouseScrollAxisY = 'saxy' kSynergyMouseScrollAxisY = 'saxy'
}; };
// TODO: upgrade deprecated function usage in these functions.
void setZeroSuppressionInterval();
void avoidSupression();
void logCursorVisibility();
void avoidHesitatingCursor();
// //
// COSXScreen // COSXScreen
// //
@ -747,15 +753,7 @@ COSXScreen::showCursor()
// appears to fix "mouse randomly not showing" bug // appears to fix "mouse randomly not showing" bug
CGAssociateMouseAndMouseCursorPosition(true); CGAssociateMouseAndMouseCursorPosition(true);
#pragma GCC diagnostic push logCursorVisibility();
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// CGCursorIsVisible is probably deprecated because its unreliable.
if (!CGCursorIsVisible()) {
LOG((CLOG_WARN "cursor may not be visible"));
}
#pragma GCC diagnostic pop
m_cursorHidden = false; m_cursorHidden = false;
} }
@ -782,15 +780,7 @@ COSXScreen::hideCursor()
// appears to fix "mouse randomly not hiding" bug // appears to fix "mouse randomly not hiding" bug
CGAssociateMouseAndMouseCursorPosition(true); CGAssociateMouseAndMouseCursorPosition(true);
#pragma GCC diagnostic push logCursorVisibility();
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// CGCursorIsVisible is probably deprecated because its unreliable.
if (CGCursorIsVisible()) {
LOG((CLOG_WARN "cursor may be still visible"));
}
#pragma GCC diagnostic pop
m_cursorHidden = true; m_cursorHidden = true;
} }
@ -884,16 +874,7 @@ COSXScreen::enter()
showCursor(); showCursor();
if (m_isPrimary) { if (m_isPrimary) {
setZeroSuppressionInterval();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
CGSetLocalEventsSuppressionInterval(0.0);
#pragma GCC diagnostic pop
// enable global hotkeys
//setGlobalHotKeysEnabled(true);
} }
else { else {
// reset buttons // reset buttons
@ -905,26 +886,13 @@ COSXScreen::enter()
io_registry_entry_t entry = IORegistryEntryFromPath( io_registry_entry_t entry = IORegistryEntryFromPath(
kIOMasterPortDefault, kIOMasterPortDefault,
"IOService:/IOResources/IODisplayWrangler"); "IOService:/IOResources/IODisplayWrangler");
if (entry != MACH_PORT_NULL) { if (entry != MACH_PORT_NULL) {
IORegistryEntrySetCFProperty(entry, CFSTR("IORequestIdle"), kCFBooleanFalse); IORegistryEntrySetCFProperty(entry, CFSTR("IORequestIdle"), kCFBooleanFalse);
IOObjectRelease(entry); IOObjectRelease(entry);
} }
#pragma GCC diagnostic push avoidSupression();
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// avoid suppression of local hardware events
// stkamp@users.sourceforge.net
CGSetLocalEventsFilterDuringSupressionState(
kCGEventFilterMaskPermitAllEvents,
kCGEventSupressionStateSupressionInterval);
CGSetLocalEventsFilterDuringSupressionState(
(kCGEventFilterMaskPermitLocalKeyboardEvents |
kCGEventFilterMaskPermitSystemDefinedEvents),
kCGEventSupressionStateRemoteMouseDrag);
#pragma GCC diagnostic pop
} }
// now on screen // now on screen
@ -963,31 +931,8 @@ COSXScreen::leave()
} }
if (m_isPrimary) { if (m_isPrimary) {
// warp to center avoidHesitatingCursor();
//warpCursor(m_xCenter, m_yCenter);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// This used to be necessary to get smooth mouse motion on other screens,
// but now is just to avoid a hesitating cursor when transitioning to
// the primary (this) screen.
CGSetLocalEventsSuppressionInterval(0.0001);
// disable global hotkeys
//setGlobalHotKeysEnabled(false);
#pragma GCC diagnostic pop
}
else {
// warp the mouse to the cursor center
//fakeMouseMove(m_xCenter, m_yCenter);
// FIXME -- prepare to show cursor if it moves
// take keyboard focus
// FIXME
} }
// now off screen // now off screen
@ -2154,3 +2099,50 @@ COSXScreen::getDraggingFilename()
} }
return m_draggingFilename; return m_draggingFilename;
} }
#if GNUC_46
# pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void
setZeroSuppressionInterval()
{
CGSetLocalEventsSuppressionInterval(0.0);
}
void
avoidSupression()
{
// avoid suppression of local hardware events
// stkamp@users.sourceforge.net
CGSetLocalEventsFilterDuringSupressionState(
kCGEventFilterMaskPermitAllEvents,
kCGEventSupressionStateSupressionInterval);
CGSetLocalEventsFilterDuringSupressionState(
(kCGEventFilterMaskPermitLocalKeyboardEvents |
kCGEventFilterMaskPermitSystemDefinedEvents),
kCGEventSupressionStateRemoteMouseDrag);
}
void
logCursorVisibility()
{
// CGCursorIsVisible is probably deprecated because its unreliable.
if (!CGCursorIsVisible()) {
LOG((CLOG_WARN "cursor may not be visible"));
}
}
void
avoidHesitatingCursor()
{
// This used to be necessary to get smooth mouse motion on other screens,
// but now is just to avoid a hesitating cursor when transitioning to
// the primary (this) screen.
CGSetLocalEventsSuppressionInterval(0.0001);
}
#if GNUC_46
# pragma GCC diagnostic pop
#endif

View File

@ -24,11 +24,9 @@
#import <string.h> #import <string.h>
#import <sys/sysctl.h> #import <sys/sysctl.h>
void // TODO: upgrade deprecated function usage in these functions.
getProcessSerialNumber(const char* name, ProcessSerialNumber& psn); void getProcessSerialNumber(const char* name, ProcessSerialNumber& psn);
bool testProcessName(const char* name, const ProcessSerialNumber& psn);
bool
testProcessName(const char* name, const ProcessSerialNumber& psn);
// //
// COSXScreenSaver // COSXScreenSaver
@ -163,7 +161,9 @@ COSXScreenSaver::launchTerminationCallback(
return (CallNextEventHandler(nextHandler, theEvent)); return (CallNextEventHandler(nextHandler, theEvent));
} }
#if GNUC_46
# pragma GCC diagnostic push # pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void void
@ -199,4 +199,6 @@ testProcessName(const char* name, const ProcessSerialNumber& psn)
return (err == 0 && CFEqual(CFSTR("ScreenSaverEngine"), processName)); return (err == 0 && CFEqual(CFSTR("ScreenSaverEngine"), processName));
} }
#if GNUC_46
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif