diff options
| author | Grégoire Jadi | 2013-07-25 15:34:02 +0200 |
|---|---|---|
| committer | Grégoire Jadi | 2013-07-25 15:34:02 +0200 |
| commit | 5558a52357ad7871aa2f66901032f6abb18485a5 (patch) | |
| tree | b894d3cca185d06c9642eacba894d2c165ef3f33 /src | |
| parent | 7e457d94c0d3effe78d652d0141c53c41ce06b53 (diff) | |
| download | emacs-5558a52357ad7871aa2f66901032f6abb18485a5.tar.gz emacs-5558a52357ad7871aa2f66901032f6abb18485a5.zip | |
* src/xwidget.c (xwidget_init_view): Pass the view rather than the model
to the callback for "clicked" event so we can retrive the frame and remove
an old TODO.
(buttonclick_handler): Get the frame from the window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xwidget.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/xwidget.c b/src/xwidget.c index eebb17d1aed..80cfd8355df 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -331,29 +331,25 @@ xwidget_hidden(struct xwidget_view *xv) | |||
| 331 | static void | 331 | static void |
| 332 | buttonclick_handler (GtkWidget * widget, gpointer data) | 332 | buttonclick_handler (GtkWidget * widget, gpointer data) |
| 333 | { | 333 | { |
| 334 | Lisp_Object xw; | 334 | Lisp_Object xwidget_view, xwidget; |
| 335 | XSETXWIDGET(xw, (struct xwidget *) data); | 335 | XSETXWIDGET_VIEW (xwidget_view, (struct xwidget_view *) data); |
| 336 | xwidget = Fxwidget_view_model (xwidget_view); | ||
| 336 | 337 | ||
| 337 | struct input_event event; | 338 | struct input_event event; |
| 338 | Lisp_Object frame; | 339 | Lisp_Object frame = Fwindow_frame (Fxwidget_view_window (xwidget_view)); |
| 339 | FRAME_PTR f = NULL; //(FRAME_PTR) g_object_get_data (G_OBJECT (XXWIDGET (xw)->widget), XG_FRAME_DATA); //TODO | 340 | FRAME_PTR f = XFRAME (frame); |
| 340 | printf ("button clicked xw:%d '%s'\n", xw, XXWIDGET (xw)->title); | 341 | printf ("button clicked xw:%d '%s'\n", XXWIDGET (xwidget), XXWIDGET (xwidget)->title); |
| 341 | 342 | ||
| 342 | EVENT_INIT (event); | 343 | EVENT_INIT (event); |
| 343 | event.kind = XWIDGET_EVENT; | 344 | event.kind = XWIDGET_EVENT; |
| 344 | 345 | ||
| 345 | XSETFRAME (frame, f); | 346 | event.frame_or_window = frame; |
| 346 | |||
| 347 | event.frame_or_window = Qnil; //frame; //how to get the frame here? | ||
| 348 | |||
| 349 | 347 | ||
| 350 | event.arg = Qnil; | 348 | event.arg = Qnil; |
| 351 | event.arg = Fcons (xw, event.arg); | 349 | event.arg = Fcons (xwidget, event.arg); |
| 352 | event.arg = Fcons (intern ("buttonclick"), event.arg); | 350 | event.arg = Fcons (intern ("buttonclick"), event.arg); |
| 353 | 351 | ||
| 354 | kbd_buffer_store_event (&event); | 352 | kbd_buffer_store_event (&event); |
| 355 | |||
| 356 | |||
| 357 | } | 353 | } |
| 358 | 354 | ||
| 359 | 355 | ||
| @@ -961,7 +957,6 @@ xwidget_init_view (struct xwidget *xww, | |||
| 961 | struct glyph_string *s, | 957 | struct glyph_string *s, |
| 962 | int x, int y) | 958 | int x, int y) |
| 963 | { | 959 | { |
| 964 | //TODO temp code replace with lisp list | ||
| 965 | struct xwidget_view *xv = allocate_xwidget_view(); | 960 | struct xwidget_view *xv = allocate_xwidget_view(); |
| 966 | Lisp_Object val; | 961 | Lisp_Object val; |
| 967 | GdkColor color; | 962 | GdkColor color; |
| @@ -977,7 +972,7 @@ xwidget_init_view (struct xwidget *xww, | |||
| 977 | { | 972 | { |
| 978 | xv->widget = gtk_button_new_with_label (XSTRING(xww->title)->data); | 973 | xv->widget = gtk_button_new_with_label (XSTRING(xww->title)->data); |
| 979 | g_signal_connect (G_OBJECT (xv->widget), "clicked", | 974 | g_signal_connect (G_OBJECT (xv->widget), "clicked", |
| 980 | G_CALLBACK (buttonclick_handler), xww); //the model rather than the view | 975 | G_CALLBACK (buttonclick_handler), xv); // the view rather than the model |
| 981 | } else if (EQ(xww->type, Qtoggle)) { | 976 | } else if (EQ(xww->type, Qtoggle)) { |
| 982 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); | 977 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); |
| 983 | //xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing | 978 | //xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing |