Set window user data using separate function

dev
Kristian Høgsberg 15 years ago
parent dcb71b62a0
commit c8c3734ef9
  1. 3
      clients/flower.c
  2. 9
      clients/gears.c
  3. 5
      clients/image.c
  4. 8
      clients/terminal.c
  5. 7
      clients/view.c
  6. 24
      clients/window.c
  7. 21
      clients/window.h

@ -141,7 +141,8 @@ int main(int argc, char *argv[])
draw_stuff(s, flower.width, flower.height);
cairo_surface_flush(s);
window_set_frame_handler(flower.window, handle_frame, &flower);
window_set_user_data(flower.window, &flower);
window_set_frame_handler(flower.window, handle_frame);
window_commit(flower.window, 0);
display_run(d);

@ -431,10 +431,11 @@ gears_create(struct display *display)
draw_gears(gears);
frame_handler(gears->window, 0, 0, gears);
window_set_resize_handler(gears->window, resize_handler, gears);
window_set_keyboard_focus_handler(gears->window, keyboard_focus_handler, gears);
window_set_acknowledge_handler(gears->window, acknowledge_handler, gears);
window_set_frame_handler(gears->window, frame_handler, gears);
window_set_user_data(gears->window, gears);
window_set_resize_handler(gears->window, resize_handler);
window_set_keyboard_focus_handler(gears->window, keyboard_focus_handler);
window_set_acknowledge_handler(gears->window, acknowledge_handler);
window_set_frame_handler(gears->window, frame_handler);
return gears;
}

@ -223,8 +223,9 @@ image_create(struct display *display, uint32_t key, const char *filename)
* allocation scheme here. Or maybe just a real toolkit. */
image->key = key + 100;
window_set_redraw_handler(image->window, redraw_handler, image);
window_set_keyboard_focus_handler(image->window, keyboard_focus_handler, image);
window_set_user_data(image->window, image);
window_set_redraw_handler(image->window, redraw_handler);
window_set_keyboard_focus_handler(image->window, keyboard_focus_handler);
image_draw(image);

@ -438,12 +438,12 @@ terminal_create(struct display *display, int fullscreen)
terminal->margin = 5;
window_set_fullscreen(terminal->window, terminal->fullscreen);
window_set_redraw_handler(terminal->window,
redraw_handler, terminal);
window_set_user_data(terminal->window, terminal);
window_set_redraw_handler(terminal->window, redraw_handler);
window_set_key_handler(terminal->window, key_handler, terminal);
window_set_key_handler(terminal->window, key_handler);
window_set_keyboard_focus_handler(terminal->window,
keyboard_focus_handler, terminal);
keyboard_focus_handler);
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 0, 0);
cr = cairo_create(surface);

@ -184,10 +184,11 @@ view_create(struct display *display, uint32_t key, const char *filename)
* allocation scheme here. Or maybe just a real toolkit. */
view->key = key + 100;
window_set_redraw_handler(view->window, redraw_handler, view);
window_set_key_handler(view->window, key_handler, view);
window_set_user_data(view->window, view);
window_set_redraw_handler(view->window, redraw_handler);
window_set_key_handler(view->window, key_handler);
window_set_keyboard_focus_handler(view->window,
keyboard_focus_handler, view);
keyboard_focus_handler);
view->document = poppler_document_new_from_file(view->filename,
NULL, &error);

@ -678,52 +678,52 @@ window_set_decoration(struct window *window, int decoration)
window->decoration = decoration;
}
void
window_set_user_data(struct window *window, void *data)
{
window->user_data = data;
}
void
window_set_resize_handler(struct window *window,
window_resize_handler_t handler, void *data)
window_resize_handler_t handler)
{
window->resize_handler = handler;
window->user_data = data;
}
void
window_set_redraw_handler(struct window *window,
window_redraw_handler_t handler, void *data)
window_redraw_handler_t handler)
{
window->redraw_handler = handler;
window->user_data = data;
}
void
window_set_key_handler(struct window *window,
window_key_handler_t handler, void *data)
window_key_handler_t handler)
{
window->key_handler = handler;
window->user_data = data;
}
void
window_set_acknowledge_handler(struct window *window,
window_acknowledge_handler_t handler, void *data)
window_acknowledge_handler_t handler)
{
window->acknowledge_handler = handler;
window->user_data = data;
}
void
window_set_frame_handler(struct window *window,
window_frame_handler_t handler, void *data)
window_frame_handler_t handler)
{
window->frame_handler = handler;
window->user_data = data;
}
void
window_set_keyboard_focus_handler(struct window *window,
window_keyboard_focus_handler_t handler, void *data)
window_keyboard_focus_handler_t handler)
{
window->keyboard_focus_handler = handler;
window->user_data = data;
}
void

@ -102,37 +102,40 @@ window_copy_surface(struct window *window,
void
window_set_fullscreen(struct window *window, int fullscreen);
void
window_set_user_data(struct window *window, void *data);
void
window_set_redraw_handler(struct window *window,
window_redraw_handler_t handler, void *data);
window_redraw_handler_t handler);
void
window_set_decoration(struct window *window, int decoration);
void
window_set_resize_handler(struct window *window,
window_resize_handler_t handler, void *data);
window_resize_handler_t handler);
void
window_set_frame_handler(struct window *window,
window_frame_handler_t handler, void *data);
window_frame_handler_t handler);
void
window_set_acknowledge_handler(struct window *window,
window_acknowledge_handler_t handler, void *data);
window_acknowledge_handler_t handler);
void
window_set_key_handler(struct window *window,
window_key_handler_t handler, void *data);
window_key_handler_t handler);
void
window_set_keyboard_focus_handler(struct window *window,
window_keyboard_focus_handler_t handler,
void *data);
window_keyboard_focus_handler_t handler);
void
window_set_acknowledge_handler(struct window *window,
window_acknowledge_handler_t handler, void *data);
window_acknowledge_handler_t handler);
void
window_set_frame_handler(struct window *window,
window_frame_handler_t handler, void *data);
window_frame_handler_t handler);
#endif

Loading…
Cancel
Save