mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- added many new things and fixed a number of bugs (too tried to mention them all)
This commit is contained in:
@@ -784,7 +784,7 @@ void showCursor(bool b) {
|
||||
}
|
||||
SDL_ShowCursor(b ? SDL_ENABLE : SDL_DISABLE);
|
||||
if(b) {
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
//SDL_WarpMouse(x,y);
|
||||
}
|
||||
}
|
||||
|
@@ -1465,6 +1465,7 @@ void BroadCastClientSocketThread::execute() {
|
||||
ServerSocket::ServerSocket() : Socket() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
portBound = false;
|
||||
broadCastThread = NULL;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@@ -1513,9 +1514,19 @@ bool ServerSocket::isBroadCastThreadRunning() {
|
||||
return isThreadRunning;
|
||||
}
|
||||
|
||||
void ServerSocket::bind(int port)
|
||||
{
|
||||
void ServerSocket::bind(int port) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d port = %d, portBound = %d START\n",__FILE__,__FUNCTION__,__LINE__,port,portBound);
|
||||
|
||||
boundPort = port;
|
||||
|
||||
if(isSocketValid() == false) {
|
||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if(isSocketValid() == false) {
|
||||
throwException("Error creating socket");
|
||||
}
|
||||
setBlock(false);
|
||||
}
|
||||
|
||||
//sockaddr structure
|
||||
sockaddr_in addr;
|
||||
addr.sin_family= AF_INET;
|
||||
@@ -1540,6 +1551,14 @@ void ServerSocket::bind(int port)
|
||||
sprintf(szBuf, "Error binding socket sock = %d, err = %d, error = %s\n",sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
portBound = true;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d port = %d, portBound = %d END\n",__FILE__,__FUNCTION__,__LINE__,port,portBound);
|
||||
}
|
||||
|
||||
void ServerSocket::disconnectSocket() {
|
||||
Socket::disconnectSocket();
|
||||
portBound = false;
|
||||
}
|
||||
|
||||
void ServerSocket::listen(int connectionQueueSize) {
|
||||
@@ -1554,6 +1573,9 @@ void ServerSocket::listen(int connectionQueueSize) {
|
||||
throwException("Error creating socket");
|
||||
}
|
||||
setBlock(false);
|
||||
}
|
||||
|
||||
if(portBound == false) {
|
||||
bind(boundPort);
|
||||
}
|
||||
|
||||
@@ -1579,8 +1601,12 @@ void ServerSocket::listen(int connectionQueueSize) {
|
||||
}
|
||||
}
|
||||
|
||||
Socket *ServerSocket::accept()
|
||||
{
|
||||
Socket *ServerSocket::accept() {
|
||||
|
||||
if(isSocketValid() == false) {
|
||||
throwException("socket is invalid!");
|
||||
}
|
||||
|
||||
struct sockaddr_in cli_addr;
|
||||
socklen_t clilen = sizeof(cli_addr);
|
||||
char client_host[100]="";
|
||||
|
@@ -49,6 +49,7 @@ bool Window::isFullScreen = false;
|
||||
SDL_keysym Window::keystate;
|
||||
|
||||
bool Window::isActive = false;
|
||||
bool Window::no2DMouseRendering = false;
|
||||
|
||||
// ========== PUBLIC ==========
|
||||
|
||||
@@ -176,8 +177,10 @@ bool Window::handleEvent() {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
showCursor(!Window::isActive);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) {
|
||||
showCursor(!Window::isActive);
|
||||
}
|
||||
}
|
||||
// Check if the program has lost window focus
|
||||
else if (event.active.state == SDL_APPACTIVE) {
|
||||
@@ -188,8 +191,10 @@ bool Window::handleEvent() {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
showCursor(!Window::isActive);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) {
|
||||
showCursor(!Window::isActive);
|
||||
}
|
||||
}
|
||||
// Check if the program has lost window focus
|
||||
else if (event.active.state == SDL_APPMOUSEFOCUS) {
|
||||
@@ -200,8 +205,10 @@ bool Window::handleEvent() {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
showCursor(!Window::isActive);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) {
|
||||
showCursor(!Window::isActive);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (event.active.gain == 0) {
|
||||
@@ -211,8 +218,10 @@ bool Window::handleEvent() {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
showCursor(!Window::isActive);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) {
|
||||
showCursor(!Window::isActive);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -413,8 +422,10 @@ void Window::toggleFullscreen() {
|
||||
|
||||
if(Window::isFullScreen == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle);
|
||||
ShowWindow(handle, SW_MAXIMIZE);
|
||||
showCursor(false);
|
||||
ShowWindow(handle, SW_MAXIMIZE);
|
||||
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) {
|
||||
showCursor(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle);
|
||||
|
Reference in New Issue
Block a user