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 | ||
---|---|---|
39 | 39 | |
40 | 40 | void main_window::connect_all() |
41 | 41 | { |
42 | (*this).add_events( Gdk::BUTTON_PRESS_MASK ) ; | |
42 | 43 | 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)); | |
45 | 49 | log_debug((*this).press_id << " " << (*this).release_id); |
46 | 50 | } |
47 | 51 | |
... | ... | |
64 | 68 | static int key_s = 115; |
65 | 69 | static int key_t = 116; |
66 | 70 | 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 | ||
67 | 76 | |
68 | 77 | // key commands only available if ctrl pressed |
69 | 78 | if ((ctrl_state == 1) && ((*this).press_id == 1)) |
... | ... | |
106 | 115 | |
107 | 116 | } |
108 | 117 | |
109 | bool main_window::on_my_key_press_event(GdkEventKey *Key) | |
118 | void main_window::on_notify_key_press_event(GdkEventKey *Key) | |
110 | 119 | { |
120 | ||
111 | 121 | if (Key->keyval == gdk_keyval_from_name("Control_R")) |
112 | 122 | { |
113 | 123 | ctrl_state = 1; |
... | ... | |
116 | 126 | { |
117 | 127 | actions(Key->keyval); |
118 | 128 | } |
119 | // log_debug("Key Presssed is " << Key->keyval); | |
120 | return true; | |
129 | log_debug("Key Presssed is " << Key->keyval); | |
121 | 130 | } |
122 | 131 | |
123 | bool main_window::on_my_key_release_event(GdkEventKey *Key) | |
132 | void main_window::on_notify_key_release_event(GdkEventKey *Key) | |
124 | 133 | { |
125 | 134 | if (Key->keyval == gdk_keyval_from_name("Control_R")) |
126 | 135 | { |
127 | 136 | ctrl_state = 0; |
128 | 137 | } |
129 | 138 | |
130 | return true; | |
131 | 139 | } |
132 | 140 | |
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 | ||
133 | 165 | bool main_window::quit() |
134 | 166 | { |
135 | 167 | hide(); |
src/main_window.hh | ||
---|---|---|
35 | 35 | private: |
36 | 36 | bool actions(int); |
37 | 37 | 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); | |
40 | 42 | bool quit(); |
41 | 43 | }; |
42 | 44 |
Branches:
development
master