summaryrefslogtreecommitdiff
path: root/games/trackballs/patches/trackballs-1.1.4-remove-old-sdl-workarounds.patch
blob: 21c9a58c20b518f05601ff98d34ec20b38669b78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
diff -up trackballs-1.1.4/src/gameMode.cc~ trackballs-1.1.4/src/gameMode.cc
--- trackballs-1.1.4/src/gameMode.cc~	2006-08-06 14:01:39.000000000 +0200
+++ trackballs-1.1.4/src/gameMode.cc	2011-05-18 15:51:03.320256212 +0200
@@ -26,9 +26,8 @@ using namespace std;
 
 GameMode *GameMode::current;
 
-GameMode::GameMode() { keyUpReceived=1; }
-GameMode::~GameMode() {
-}
+GameMode::GameMode() {}
+GameMode::~GameMode() {}
 void GameMode::activate(GameMode* gm) { 
   if(current) current->deactivated();
   current = gm; 
@@ -36,7 +35,6 @@ void GameMode::activate(GameMode* gm) { 
 }
 void GameMode::display(){}
 void GameMode::key(int){}
-void GameMode::keyUp(int){ keyUpReceived=1; }
 void GameMode::special(int key,int x,int y){}
 void GameMode::idle(Real td){}
 void GameMode::mouse(int state,int x,int y){}
diff -up trackballs-1.1.4/src/gameMode.h~ trackballs-1.1.4/src/gameMode.h
--- trackballs-1.1.4/src/gameMode.h~	2006-08-06 14:01:20.000000000 +0200
+++ trackballs-1.1.4/src/gameMode.h	2011-05-18 15:49:50.760256145 +0200
@@ -33,7 +33,6 @@ class GameMode {
 
   virtual void display();
   virtual void key(int);
-  virtual void keyUp(int);
   virtual void special(int,int,int);
   virtual void idle(Real dt);
   virtual void doExpensiveComputations();
@@ -44,9 +43,6 @@ class GameMode {
 
   static void activate(GameMode*);
   static GameMode *current;
- protected:
-  int keyUpReceived;
- private:
 };
 
 #endif
diff -up trackballs-1.1.4/src/mainMode.cc~ trackballs-1.1.4/src/mainMode.cc
--- trackballs-1.1.4/src/mainMode.cc~	2007-05-25 12:23:50.000000000 +0200
+++ trackballs-1.1.4/src/mainMode.cc	2011-05-18 15:45:44.458256059 +0200
@@ -464,11 +464,6 @@ void MainMode::activated() {
   camFocus[1] = Game::current->map->startPosition[1] - 5;
   time = 0.0;
   flash = 0.0;
-
-  /* Fix for an apparanet bug in my SDL + Xorg combination... */
-  SDL_WM_ToggleFullScreen(screen);
-  SDL_WM_ToggleFullScreen(screen);
-
 }
 void MainMode::deactivated() { free(viewportData); viewportData=NULL; }
 void MainMode::playerLoose() { Game::current->gamer->playerLoose(); gameStatus=statusGameOver; }
diff -up trackballs-1.1.4/src/mmad.cc~ trackballs-1.1.4/src/mmad.cc
--- trackballs-1.1.4/src/mmad.cc~	2011-05-18 14:55:38.000000000 +0200
+++ trackballs-1.1.4/src/mmad.cc	2011-05-18 16:11:33.817256492 +0200
@@ -411,7 +411,6 @@ void innerMain(void *closure,int argc,ch
   /* Initialize random number generator */
   int seed=(int) getSystemTime();
   srand(seed);
-  int keyUpReceived=1;
 
   while(is_running) {
 
@@ -469,9 +468,6 @@ void innerMain(void *closure,int argc,ch
 	    if(GameMode::current) GameMode::current->mouseDown(e->button,e->x,e->y);
 	    break;
 	  case SDL_KEYUP:
-	    /* Prevent repeated keys */
-	    keyUpReceived=1;
-
 	    /* Use Caps lock key to determine if mouse should be hidden+grabbed */
 	    if(event.key.keysym.sym == SDLK_CAPSLOCK) {	  
 	      if(SDL_GetModState() & KMOD_CAPS) {
@@ -481,12 +477,12 @@ void innerMain(void *closure,int argc,ch
 		SDL_WM_GrabInput(SDL_GRAB_ON);
 		SDL_ShowCursor(SDL_DISABLE);
 	      }
-	    } else
-	      GameMode::current->keyUp(event.key.keysym.sym);
+	    }
+	    break;
 	  case SDL_KEYDOWN:
-
 	    /* Always quit if the 'q' key is pressed */
-	    if(event.key.keysym.sym == 'q' && SDL_GetModState() & KMOD_CTRL) exit(0);
+	    if(event.key.keysym.sym == 'q' && SDL_GetModState() & KMOD_CTRL)
+	      exit(0);
 
 	    /* Change between fullscreen/windowed mode if the 'f' key
 	       is pressed */
@@ -525,14 +521,13 @@ void innerMain(void *closure,int argc,ch
 		((EditMode*)GameMode::current)->askQuit();
 	      } else if((GameMode::current && GameMode::current == MenuMode::menuMode))
 		is_running=0;
-	      else { GameMode::activate(MenuMode::menuMode); while(SDL_PollEvent(&event)) {} }
-
+	      else {
+	        GameMode::activate(MenuMode::menuMode);
+	        while(SDL_PollEvent(&event)) {}
+              }
 	    }
-	    else if(GameMode::current) {
-	      /* Prevent repeated keys */
-	      if(!keyUpReceived) break;
-	      keyUpReceived=0;
 
+	    else if(GameMode::current) {
 	      GameMode::current->key(event.key.keysym.sym);
 	    }