comparison src/gpmevent.c @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 25f70ba0133c
children e121b013d1f0
comparison
equal deleted inserted replaced
154:94141801dd7e 155:43dd3413c7c7
90 int connect_to_gpm(struct console *con) 90 int connect_to_gpm(struct console *con)
91 { 91 {
92 /* Only do this if we are running after dumping and really interactive */ 92 /* Only do this if we are running after dumping and really interactive */
93 if (!noninteractive && initialized) { 93 if (!noninteractive && initialized) {
94 /* We really only want to do this on a TTY */ 94 /* We really only want to do this on a TTY */
95 CONSOLE_TTY_MOUSE_FD (con) = -1;
95 if (EQ (CONSOLE_TYPE (con), Qtty)) { 96 if (EQ (CONSOLE_TYPE (con), Qtty)) {
96 Gpm_Connect conn; 97 Gpm_Connect conn;
98 int rval;
97 99
98 conn.eventMask = GPM_DOWN|GPM_UP|GPM_MOVE; 100 conn.eventMask = GPM_DOWN|GPM_UP|GPM_MOVE;
99 conn.defaultMask = GPM_MOVE; 101 conn.defaultMask = GPM_MOVE;
100 conn.minMod = 0; 102 conn.minMod = 0;
101 conn.maxMod = ((1<<KG_SHIFT)|(1<<KG_ALT)|(1<<KG_CTRL)); 103 conn.maxMod = ((1<<KG_SHIFT)|(1<<KG_ALT)|(1<<KG_CTRL));
102 104
103 if (Gpm_Open (&conn, 0) == -1) { 105 rval = Gpm_Open (&conn, 0);
104 CONSOLE_TTY_MOUSE_FD (con) = -1; 106 switch (rval) {
105 return(0); 107 case -1: /* General failure */
108 break;
109 case -2: /* We are running under an XTerm */
110 Gpm_Close();
111 break;
112 default:
113 set_descriptor_non_blocking (gpm_fd);
114 CONSOLE_TTY_MOUSE_FD (con) = gpm_fd;
106 } 115 }
107 set_descriptor_non_blocking (gpm_fd);
108 CONSOLE_TTY_MOUSE_FD (con) = gpm_fd;
109 } 116 }
110 } 117 }
111 } 118 }
112 119
113 #endif 120 #endif