comparison src/skins/ui_dock.c @ 2583:294232665cb0

more work on config
author Tomasz Mon <desowin@gmail.com>
date Tue, 20 May 2008 16:34:06 +0200
parents d0daee216c8d
children 3134a0987162
comparison
equal deleted inserted replaced
2582:9b4dfc007b87 2583:294232665cb0
22 * The Audacious team does not consider modular code linking to 22 * The Audacious team does not consider modular code linking to
23 * Audacious or using our public API to be a derived work. 23 * Audacious or using our public API to be a derived work.
24 */ 24 */
25 25
26 #include "ui_dock.h" 26 #include "ui_dock.h"
27 27 #include "skins_cfg.h"
28 #include <gdk/gdk.h> 28 #include <gdk/gdk.h>
29 #include <stdlib.h> 29 #include <stdlib.h>
30 #include <audacious/plugin.h> 30 #include <audacious/plugin.h>
31 #include "ui_skinned_window.h" 31 #include "ui_skinned_window.h"
32 32
52 52
53 static void 53 static void
54 snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by, 54 snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by,
55 gint bw, gint bh) 55 gint bw, gint bh)
56 { 56 {
57 gint sd = aud_cfg->snap_distance; 57 gint sd = config.snap_distance;
58 58
59 if ((*x + w > bx - sd) && (*x + w < bx + sd) && 59 if ((*x + w > bx - sd) && (*x + w < bx + sd) &&
60 (*y > by - h - sd) && (*y < by + bh + sd)) { 60 (*y > by - h - sd) && (*y < by + bh + sd)) {
61 *x = bx - w; 61 *x = bx - w;
62 if ((*y > by - sd) && (*y < by + sd)) 62 if ((*y > by - sd) && (*y < by + sd))
92 92
93 93
94 *off_x = 0; 94 *off_x = 0;
95 *off_y = 0; 95 *off_y = 0;
96 96
97 if (!aud_cfg->snap_windows) 97 if (!config.snap_windows)
98 return; 98 return;
99 99
100 /* 100 /*
101 * FIXME: Why not break out of the loop when we find someting 101 * FIXME: Why not break out of the loop when we find someting
102 * to snap to? 102 * to snap to?
107 107
108 nx = dw->offset_x + *off_x + x; 108 nx = dw->offset_x + *off_x + x;
109 ny = dw->offset_y + *off_y + y; 109 ny = dw->offset_y + *off_y + y;
110 110
111 /* Snap to screen edges */ 111 /* Snap to screen edges */
112 if (abs(nx) < aud_cfg->snap_distance) 112 if (abs(nx) < config.snap_distance)
113 *off_x -= nx; 113 *off_x -= nx;
114 if (abs(ny) < aud_cfg->snap_distance) 114 if (abs(ny) < config.snap_distance)
115 *off_y -= ny; 115 *off_y -= ny;
116 if (abs(nx + nw - gdk_screen_width()) < aud_cfg->snap_distance) 116 if (abs(nx + nw - gdk_screen_width()) < config.snap_distance)
117 *off_x -= nx + nw - gdk_screen_width(); 117 *off_x -= nx + nw - gdk_screen_width();
118 if (abs(ny + nh - gdk_screen_height()) < aud_cfg->snap_distance) 118 if (abs(ny + nh - gdk_screen_height()) < config.snap_distance)
119 *off_y -= ny + nh - gdk_screen_height(); 119 *off_y -= ny + nh - gdk_screen_height();
120 120
121 /* Snap to other windows */ 121 /* Snap to other windows */
122 for (wnode = wlist; wnode; wnode = g_list_next(wnode)) { 122 for (wnode = wlist; wnode; wnode = g_list_next(wnode)) {
123 temp.w = wnode->data; 123 temp.w = wnode->data;
231 SkinnedWindow *window = SKINNED_WINDOW(dw->w); 231 SkinnedWindow *window = SKINNED_WINDOW(dw->w);
232 if (window) { 232 if (window) {
233 switch(window->type) { 233 switch(window->type) {
234 234
235 case WINDOW_MAIN: 235 case WINDOW_MAIN:
236 aud_cfg->player_x = x + dw->offset_x; 236 config.player_x = x + dw->offset_x;
237 aud_cfg->player_y = y + dw->offset_y; 237 config.player_y = y + dw->offset_y;
238 break; 238 break;
239 case WINDOW_EQ: 239 case WINDOW_EQ:
240 aud_cfg->equalizer_x = x + dw->offset_x; 240 config.equalizer_x = x + dw->offset_x;
241 aud_cfg->equalizer_y = y + dw->offset_y; 241 config.equalizer_y = y + dw->offset_y;
242 break; 242 break;
243 case WINDOW_PLAYLIST: 243 case WINDOW_PLAYLIST:
244 aud_cfg->playlist_x = x + dw->offset_x; 244 config.playlist_x = x + dw->offset_x;
245 aud_cfg->playlist_y = y + dw->offset_y; 245 config.playlist_y = y + dw->offset_y;
246 break; 246 break;
247 } 247 }
248 248
249 window->x = x + dw->offset_x; 249 window->x = x + dw->offset_x;
250 window->y = y + dw->offset_y; 250 window->y = y + dw->offset_y;
336 DockedWindow *dw; 336 DockedWindow *dw;
337 337
338 gtk_window_get_position(widget, &x, &y); 338 gtk_window_get_position(widget, &x, &y);
339 gtk_window_get_size(widget, &w, &h); 339 gtk_window_get_size(widget, &w, &h);
340 340
341 if (aud_cfg->show_wm_decorations) { 341 if (config.show_wm_decorations) {
342 dock_window_resize(widget, w, new_h, w, h); 342 dock_window_resize(widget, w, new_h, w, h);
343 return; 343 return;
344 } 344 }
345 345
346 docked_list = get_docked_list(NULL, window_list, widget, 0, 0); 346 docked_list = get_docked_list(NULL, window_list, widget, 0, 0);
420 GdkEventButton * event, gboolean move_list) 420 GdkEventButton * event, gboolean move_list)
421 { 421 {
422 gint mx, my; 422 gint mx, my;
423 DockedWindow *dwin; 423 DockedWindow *dwin;
424 424
425 if (aud_cfg->show_wm_decorations) 425 if (config.show_wm_decorations)
426 return; 426 return;
427 427
428 gtk_window_present(w); 428 gtk_window_present(w);
429 mx = event->x; 429 mx = event->x;
430 my = event->y; 430 my = event->y;