Date:2010-02-22 11:56:08 (14 years 1 month ago)
Author:Mirko Lindner
Commit:7a95279f5e36778faf6d2ef9b01136e054bb8660
Message:switch from "connect" to "connect_notify"

Signed-off-by: Mirko Lindner <mirko@sharism.cc>
Files: src/main_window.cc (4 diffs)
src/main_window.hh (1 diff)

Change Details

src/main_window.cc
3939
4040void main_window::connect_all()
4141{
42        (*this).add_events( Gdk::BUTTON_PRESS_MASK ) ;
4243        log_debug("connecting all");
43        (*this).press_id = signal_key_press_event().connect(sigc::mem_fun(*this,&main_window::on_my_key_press_event));
44    (*this).release_id = signal_key_release_event().connect(sigc::mem_fun(*this,&main_window::on_my_key_release_event));
44// (*this).press_id = signal_key_press_event().connect(sigc::mem_fun(*this,&main_window::on_my_key_press_event));
45// (*this).release_id = signal_key_release_event().connect(sigc::mem_fun(*this,&main_window::on_my_key_release_event));
46// (*this).press_id =
47        (*this).press_id = (*this).signal_key_press_event().connect_notify(sigc::mem_fun(*this,&main_window::on_notify_key_press_event));
48    (*this).release_id = (*this).signal_key_press_event().connect_notify(sigc::mem_fun(*this,&main_window::on_notify_key_release_event));
4549        log_debug((*this).press_id << " " << (*this).release_id);
4650}
4751
...... 
6468    static int key_s = 115;
6569    static int key_t = 116;
6670        static int key_f1 = 65470;
71        static int left = 65361;
72        static int top = 65362;
73        static int right = 65363;
74        static int bottom = 65364;
75
6776
6877        // key commands only available if ctrl pressed
6978        if ((ctrl_state == 1) && ((*this).press_id == 1))
...... 
106115
107116}
108117
109bool main_window::on_my_key_press_event(GdkEventKey *Key)
118void main_window::on_notify_key_press_event(GdkEventKey *Key)
110119{
120
111121    if (Key->keyval == gdk_keyval_from_name("Control_R"))
112122    {
113123        ctrl_state = 1;
...... 
116126    {
117127            actions(Key->keyval);
118128    }
119// log_debug("Key Presssed is " << Key->keyval);
120    return true;
129    log_debug("Key Presssed is " << Key->keyval);
121130}
122131
123bool main_window::on_my_key_release_event(GdkEventKey *Key)
132void main_window::on_notify_key_release_event(GdkEventKey *Key)
124133{
125134    if (Key->keyval == gdk_keyval_from_name("Control_R"))
126135    {
127136        ctrl_state = 0;
128137    }
129138
130    return true;
131139}
132140
141// bool main_window::on_my_key_press_event(GdkEventKey *Key)
142// {
143// if (Key->keyval == gdk_keyval_from_name("Control_R"))
144// {
145// ctrl_state = 1;
146// }
147// else
148// {
149// actions(Key->keyval);
150// }
151// log_debug("Key Presssed is " << Key->keyval);
152// return true;
153// }
154
155// bool main_window::on_my_key_release_event(GdkEventKey *Key)
156// {
157// if (Key->keyval == gdk_keyval_from_name("Control_R"))
158// {
159// ctrl_state = 0;
160// }
161//
162// return true;
163// }
164
133165bool main_window::quit()
134166{
135167    hide();
src/main_window.hh
3535    private:
3636      bool actions(int);
3737      int ctrl_state;
38      bool on_my_key_press_event(GdkEventKey *event);
39      bool on_my_key_release_event(GdkEventKey *event);
38// bool on_my_key_press_event(GdkEventKey *event);
39            void on_notify_key_press_event(GdkEventKey *event);
40            void on_notify_key_release_event(GdkEventKey *event);
41// bool on_my_key_release_event(GdkEventKey *event);
4042      bool quit();
4143};
4244

Archive Download the corresponding diff file

Branches:
development
master



interactive