Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class HeaderTemplateManager
HeaderTemplate *getFirstHeader( void );
HeaderTemplate *getNextHeader( HeaderTemplate *ht );

void headerNotifyResolutionChange(void);
void onResolutionChanged(void);

private:
void populateGameFonts( void );
Expand Down
11 changes: 8 additions & 3 deletions Generals/Code/GameEngine/Include/GameClient/Mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class Mouse : public SubsystemInterface
CursorCaptureBlockReason_NoInit,
CursorCaptureBlockReason_Paused,
CursorCaptureBlockReason_Unfocused,
CursorCaptureBlockReadon_CursorIsOutside,

CursorCaptureBlockReason_Count
};
Expand Down Expand Up @@ -310,10 +311,14 @@ class Mouse : public SubsystemInterface
Int getCursorIndex( const AsciiString& name );
void resetTooltipDelay( void );

virtual void loseFocus();
virtual void regainFocus();
virtual void loseFocus(); ///< called when window has lost focus
virtual void regainFocus(); ///< called when window has regained focus

void mouseNotifyResolutionChange(void);
void onCursorMovedOutside(); ///< called when cursor has left game window
void onCursorMovedInside(); ///< called when cursor has entered game window
Bool isCursorInside() const; ///< true if the mouse is located inside the game window

void onResolutionChanged(void);
void onGameModeChanged(GameMode prev, GameMode next);
void onGamePaused(Bool paused);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ void DeclineResolution()
TheWritableGlobalData->m_xResolution = newDispSettings.xRes;
TheWritableGlobalData->m_yResolution = newDispSettings.yRes;

TheHeaderTemplateManager->headerNotifyResolutionChange();
TheMouse->mouseNotifyResolutionChange();
TheHeaderTemplateManager->onResolutionChanged();
TheMouse->onResolutionChanged();

AsciiString prefString;
prefString.format("%d %d", newDispSettings.xRes, newDispSettings.yRes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1540,8 +1540,8 @@ static void saveOptions( void )
TheWritableGlobalData->m_xResolution = xres;
TheWritableGlobalData->m_yResolution = yres;

TheHeaderTemplateManager->headerNotifyResolutionChange();
TheMouse->mouseNotifyResolutionChange();
TheHeaderTemplateManager->onResolutionChanged();
TheMouse->onResolutionChanged();

//Save new settings for a dialog box confirmation after options are accepted
newDispSettings.xRes = xres;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ HeaderTemplate *HeaderTemplateManager::getNextHeader( HeaderTemplate *ht )

}

void HeaderTemplateManager::headerNotifyResolutionChange( void )
void HeaderTemplateManager::onResolutionChanged( void )
{
populateGameFonts();
}
Expand Down
23 changes: 21 additions & 2 deletions Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const char *const Mouse::CursorCaptureBlockReasonNames[] = {
"CursorCaptureBlockReason_NoInit",
"CursorCaptureBlockReason_Paused",
"CursorCaptureBlockReason_Unfocused",
"CursorCaptureBlockReason_CursorIsOutside",
};

///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -575,7 +576,7 @@ void Mouse::init( void )
m_numButtons = 2; // by default just have 2 buttons
m_numAxes = 2; // by default a normal mouse moves in a 2d plane
m_forceFeedback = FALSE;
mouseNotifyResolutionChange();
onResolutionChanged();
m_tooltipString.clear(); // redundant
m_displayTooltip = FALSE;

Expand Down Expand Up @@ -607,7 +608,7 @@ void Mouse::init( void )
//-------------------------------------------------------------------------------------------------
/** Tell mouse system display resolution changed. */
//-------------------------------------------------------------------------------------------------
void Mouse::mouseNotifyResolutionChange( void )
void Mouse::onResolutionChanged( void )
{
if(m_tooltipDisplayString)
TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString);
Expand Down Expand Up @@ -1034,6 +1035,24 @@ void Mouse::regainFocus()
unblockCapture(CursorCaptureBlockReason_Unfocused);
}

// ------------------------------------------------------------------------------------------------
void Mouse::onCursorMovedOutside()
{
blockCapture(CursorCaptureBlockReadon_CursorIsOutside);
}

// ------------------------------------------------------------------------------------------------
void Mouse::onCursorMovedInside()
{
unblockCapture(CursorCaptureBlockReadon_CursorIsOutside);
}

// ------------------------------------------------------------------------------------------------
Bool Mouse::isCursorInside() const
{
return (m_captureBlockReasonBits & (1 << CursorCaptureBlockReadon_CursorIsOutside)) == 0;
}

// ------------------------------------------------------------------------------------------------
void Mouse::initCapture()
{
Expand Down
Loading
Loading