comparison src/audacious/ui_playlist.c @ 3221:9583cd62231f trunk

implement ui_skinned_window_expose
author Tomasz Mon <desowin@gmail.com>
date Thu, 02 Aug 2007 15:40:46 +0200
parents 018b37cf0730
children bb7f5adc1677
comparison
equal deleted inserted replaced
3220:9af29d8ccb61 3221:9583cd62231f
90 void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , 90 void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt ,
91 gpointer other_cbt ); 91 gpointer other_cbt );
92 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , 92 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
93 gpointer searchdlg_win ); 93 gpointer searchdlg_win );
94 94
95 static void playlistwin_draw_frame(void);
96
97 static gboolean playlistwin_fileinfopopup_probe(gpointer * filepopup_win); 95 static gboolean playlistwin_fileinfopopup_probe(gpointer * filepopup_win);
98 96
99 static gboolean playlistwin_resizing = FALSE; 97 static gboolean playlistwin_resizing = FALSE;
100 static gint playlistwin_resize_x, playlistwin_resize_y; 98 static gint playlistwin_resize_x, playlistwin_resize_y;
101 99
390 gtk_window_resize(GTK_WINDOW(playlistwin), 388 gtk_window_resize(GTK_WINDOW(playlistwin),
391 playlistwin_get_width(), 389 playlistwin_get_width(),
392 playlistwin_get_height()); 390 playlistwin_get_height());
393 391
394 playlistwin_set_mask(); 392 playlistwin_set_mask();
395
396 draw_playlist_window(TRUE);
397 } 393 }
398 394
399 static void 395 static void
400 playlistwin_set_shade_menu(gboolean shaded) 396 playlistwin_set_shade_menu(gboolean shaded)
401 { 397 {
693 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) { 689 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) {
694 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; 690 GtkFixedChild *child_data = (GtkFixedChild *) iter->data;
695 GtkWidget *child = child_data->widget; 691 GtkWidget *child = child_data->widget;
696 g_signal_emit_by_name(child, "redraw"); 692 g_signal_emit_by_name(child, "redraw");
697 } 693 }
698 playlistwin_draw_frame();
699
700 g_mutex_unlock(resize_mutex); 694 g_mutex_unlock(resize_mutex);
701
702 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
703 gdk_window_clear(playlistwin->window);
704 } 695 }
705 696
706 static void 697 static void
707 playlistwin_motion(GtkWidget * widget, 698 playlistwin_motion(GtkWidget * widget,
708 GdkEventMotion * event, 699 GdkEventMotion * event,
1167 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 1158 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
1168 GDK_BUTTON1_MOTION_MASK, NULL, NULL, 1159 GDK_BUTTON1_MOTION_MASK, NULL, NULL,
1169 GDK_CURRENT_TIME); 1160 GDK_CURRENT_TIME);
1170 1161
1171 return FALSE; 1162 return FALSE;
1172 }
1173
1174 static gboolean
1175 playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data)
1176 {
1177 draw_playlist_window(TRUE);
1178 return FALSE;
1179 }
1180
1181 static gboolean
1182 playlistwin_focus_out(GtkWidget * widget,
1183 GdkEventButton * event, gpointer data)
1184 {
1185 draw_playlist_window(TRUE);
1186 return FALSE;
1187 }
1188
1189 void
1190 playlistwin_set_back_pixmap(void)
1191 {
1192 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
1193 gdk_window_clear(playlistwin->window);
1194 } 1163 }
1195 1164
1196 static gboolean 1165 static gboolean
1197 playlistwin_delete(GtkWidget * w, gpointer data) 1166 playlistwin_delete(GtkWidget * w, gpointer data)
1198 { 1167 {
1360 } 1329 }
1361 1330
1362 return TRUE; 1331 return TRUE;
1363 } 1332 }
1364 1333
1365 static void
1366 playlistwin_draw_frame(void)
1367 {
1368 gboolean focus =
1369 gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) ||
1370 !cfg.dim_titlebar;
1371
1372 if (cfg.playlist_shaded) {
1373 skin_draw_playlistwin_shaded(bmp_active_skin,
1374 playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc,
1375 playlistwin_get_width(), focus);
1376 }
1377 else {
1378 skin_draw_playlistwin_frame(bmp_active_skin,
1379 playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc,
1380 playlistwin_get_width(),
1381 cfg.playlist_height, focus);
1382 }
1383 }
1384
1385 void
1386 draw_playlist_window(gboolean force)
1387 {
1388
1389 if (force) {
1390 playlistwin_draw_frame();
1391 gdk_window_clear(playlistwin->window);
1392 GList *iter;
1393 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) {
1394 GtkFixedChild *child_data = (GtkFixedChild *) iter->data;
1395 GtkWidget *child = child_data->widget;
1396 gtk_widget_queue_draw(child);
1397 }
1398 gdk_flush();
1399 }
1400 }
1401
1402
1403 void 1334 void
1404 playlistwin_hide_timer(void) 1335 playlistwin_hide_timer(void)
1405 { 1336 {
1406 ui_skinned_textbox_set_text(playlistwin_time_min, " "); 1337 ui_skinned_textbox_set_text(playlistwin_time_min, " ");
1407 ui_skinned_textbox_set_text(playlistwin_time_sec, " "); 1338 ui_skinned_textbox_set_text(playlistwin_time_sec, " ");
1667 G_CALLBACK(playlistwin_motion), NULL); 1598 G_CALLBACK(playlistwin_motion), NULL);
1668 g_signal_connect(playlistwin, "enter_notify_event", 1599 g_signal_connect(playlistwin, "enter_notify_event",
1669 G_CALLBACK(playlistwin_enter), NULL); 1600 G_CALLBACK(playlistwin_enter), NULL);
1670 g_signal_connect(playlistwin, "leave_notify_event", 1601 g_signal_connect(playlistwin, "leave_notify_event",
1671 G_CALLBACK(playlistwin_leave), NULL); 1602 G_CALLBACK(playlistwin_leave), NULL);
1672 g_signal_connect_after(playlistwin, "focus_in_event",
1673 G_CALLBACK(playlistwin_focus_in), NULL);
1674 g_signal_connect_after(playlistwin, "focus_out_event",
1675 G_CALLBACK(playlistwin_focus_out), NULL);
1676 g_signal_connect(playlistwin, "style_set",
1677 G_CALLBACK(playlistwin_set_back_pixmap), NULL);
1678 1603
1679 bmp_drag_dest_set(playlistwin); 1604 bmp_drag_dest_set(playlistwin);
1680 1605
1681 /* DnD stuff */ 1606 /* DnD stuff */
1682 g_signal_connect(playlistwin, "drag-leave", 1607 g_signal_connect(playlistwin, "drag-leave",
1703 void 1628 void
1704 playlistwin_create(void) 1629 playlistwin_create(void)
1705 { 1630 {
1706 resize_mutex = g_mutex_new(); 1631 resize_mutex = g_mutex_new();
1707 playlistwin_create_window(); 1632 playlistwin_create_window();
1708
1709 /* create GC and back pixmap for custom widget to draw on */
1710 playlistwin_bg = gdk_pixmap_new(playlistwin->window,
1711 playlistwin_get_width(),
1712 playlistwin_get_height_unshaded(), -1);
1713 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
1714 1633
1715 playlistwin_create_widgets(); 1634 playlistwin_create_widgets();
1716 playlistwin_update_info(playlist_get_active()); 1635 playlistwin_update_info(playlist_get_active());
1717 1636
1718 playlistwin_infopopup = audacious_fileinfopopup_create(); 1637 playlistwin_infopopup = audacious_fileinfopopup_create();