Permalink
Browse files

Make mainpanel's fill_parent_cb also generic

  • Loading branch information...
1 parent 8f9a044 commit 853f397531e75fe1ed03d6f52bcfdd77d837a815 @davidben davidben committed Jun 3, 2010
Showing with 13 additions and 14 deletions.
  1. +2 −14 mainpanel.c
  2. +1 −0 window.h
  3. +10 −0 windowcb.c
View
@@ -1,7 +1,5 @@
#include "owl.h"
-static void owl_mainpanel_size(owl_window *parent, void *user_data);
-
void owl_mainpanel_init(owl_mainpanel *mp)
{
/* Create windows */
@@ -12,24 +10,14 @@ void owl_mainpanel_init(owl_mainpanel *mp)
mp->typwin = owl_window_new(mp->panel);
/* Set up sizing hooks */
- owl_signal_connect_object(owl_window_get_screen(), "resized", G_CALLBACK(owl_mainpanel_size), mp->panel, 0);
+ owl_signal_connect_object(owl_window_get_screen(), "resized", G_CALLBACK(owl_window_fill_parent_cb), mp->panel, 0);
g_signal_connect_swapped(mp->panel, "resized", G_CALLBACK(owl_mainpanel_layout_contents), mp);
/* Bootstrap the sizes and go */
- owl_mainpanel_size(owl_window_get_screen(), mp->panel);
+ owl_window_fill_parent_cb(owl_window_get_screen(), mp->panel);
owl_window_show_all(mp->panel);
}
-static void owl_mainpanel_size(owl_window *parent, void *user_data)
-{
- int lines, cols;
- owl_window *panel = user_data;
-
- /* Make this panel full-screen */
- owl_window_get_position(parent, &lines, &cols, NULL, NULL);
- owl_window_set_position(panel, lines, cols, 0, 0);
-}
-
void owl_mainpanel_layout_contents(owl_mainpanel *mp)
{
int lines, cols, typwin_lines;
View
@@ -57,6 +57,7 @@ void owl_window_resize(owl_window *w, int nlines, int ncols);
/* Standard callback functions in windowcb.c */
void owl_window_erase_cb(owl_window *w, WINDOW *win, void *user_data);
+void owl_window_fill_parent_cb(owl_window *parent, void *user_data);
G_END_DECLS
View
@@ -5,3 +5,13 @@ void owl_window_erase_cb(owl_window *w, WINDOW *win, void *user_data)
werase(win);
owl_window_dirty_children(w);
}
+
+void owl_window_fill_parent_cb(owl_window *parent, void *user_data)
+{
+ int lines, cols;
+ owl_window *window = user_data;
+
+ /* Make this panel full-screen */
+ owl_window_get_position(parent, &lines, &cols, NULL, NULL);
+ owl_window_set_position(window, lines, cols, 0, 0);
+}

0 comments on commit 853f397

Please sign in to comment.