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
};
// gnu 4.6+ has pragma diagnostic push and tautological-compare
#define GNUC_46 defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#endif

View File

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

View File

@ -22,15 +22,19 @@
#include "CCryptoMode.h"
#if __APPLE__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
# if GNUC_46
# pragma GCC diagnostic push
# endif
# pragma GCC diagnostic ignored "-Wall"
#endif
#include <cryptopp562/osrng.h>
#include <cryptopp562/sha.h>
#if __APPLE__
#pragma GCC diagnostic pop
# if GNUC_46
# pragma GCC diagnostic pop
# endif
#endif
class CCryptoOptions;

View File

@ -61,6 +61,12 @@ enum {
kSynergyMouseScrollAxisY = 'saxy'
};
// TODO: upgrade deprecated function usage in these functions.
void setZeroSuppressionInterval();
void avoidSupression();
void logCursorVisibility();
void avoidHesitatingCursor();
//
// COSXScreen
//
@ -747,15 +753,7 @@ COSXScreen::showCursor()
// appears to fix "mouse randomly not showing" bug
CGAssociateMouseAndMouseCursorPosition(true);
#pragma GCC diagnostic push
#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
logCursorVisibility();
m_cursorHidden = false;
}
@ -782,15 +780,7 @@ COSXScreen::hideCursor()
// appears to fix "mouse randomly not hiding" bug
CGAssociateMouseAndMouseCursorPosition(true);
#pragma GCC diagnostic push
#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
logCursorVisibility();
m_cursorHidden = true;
}
@ -884,16 +874,7 @@ COSXScreen::enter()
showCursor();
if (m_isPrimary) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
CGSetLocalEventsSuppressionInterval(0.0);
#pragma GCC diagnostic pop
// enable global hotkeys
//setGlobalHotKeysEnabled(true);
setZeroSuppressionInterval();
}
else {
// reset buttons
@ -905,26 +886,13 @@ COSXScreen::enter()
io_registry_entry_t entry = IORegistryEntryFromPath(
kIOMasterPortDefault,
"IOService:/IOResources/IODisplayWrangler");
if (entry != MACH_PORT_NULL) {
IORegistryEntrySetCFProperty(entry, CFSTR("IORequestIdle"), kCFBooleanFalse);
IOObjectRelease(entry);
}
#pragma GCC diagnostic push
#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
avoidSupression();
}
// now on screen
@ -963,31 +931,8 @@ COSXScreen::leave()
}
if (m_isPrimary) {
// warp to center
//warpCursor(m_xCenter, m_yCenter);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
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);
// 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
@ -2154,3 +2099,50 @@ COSXScreen::getDraggingFilename()
}
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 <sys/sysctl.h>
void
getProcessSerialNumber(const char* name, ProcessSerialNumber& psn);
bool
testProcessName(const char* name, const ProcessSerialNumber& psn);
// TODO: upgrade deprecated function usage in these functions.
void getProcessSerialNumber(const char* name, ProcessSerialNumber& psn);
bool testProcessName(const char* name, const ProcessSerialNumber& psn);
//
// COSXScreenSaver
@ -163,7 +161,9 @@ COSXScreenSaver::launchTerminationCallback(
return (CallNextEventHandler(nextHandler, theEvent));
}
#pragma GCC diagnostic push
#if GNUC_46
# pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void
@ -199,4 +199,6 @@ testProcessName(const char* name, const ProcessSerialNumber& psn)
return (err == 0 && CFEqual(CFSTR("ScreenSaverEngine"), processName));
}
#pragma GCC diagnostic pop
#if GNUC_46
# pragma GCC diagnostic pop
#endif