-/*
- * Copyright (c) 2012-2014, Bastien Dejean
+/* Copyright (c) 2012, Bastien Dejean
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of the FreeBSD Project.
*/
#include <stdlib.h>
#include "tree.h"
#include "window.h"
#include "desktop.h"
+#include "settings.h"
void focus_desktop(monitor_t *m, desktop_t *d)
{
{
d->layout = l;
arrange(m, d);
- if (d == mon->desk)
+ if (d == m->desk)
put_status();
}
snprintf(d->name, sizeof(d->name), "%s%d", DEFAULT_DESK_NAME, ++desktop_uid);
else
snprintf(d->name, sizeof(d->name), "%s", name);
- d->layout = LAYOUT_TILED;
d->prev = d->next = NULL;
d->root = d->focus = NULL;
+ initialize_desktop(d);
+ return d;
+}
+
+void initialize_desktop(desktop_t *d)
+{
+ d->layout = LAYOUT_TILED;
d->top_padding = d->right_padding = d->bottom_padding = d->left_padding = 0;
- d->window_gap = WINDOW_GAP;
- d->border_width = BORDER_WIDTH;
+ d->window_gap = window_gap;
+ d->border_width = border_width;
d->floating = false;
- return d;
}
void insert_desktop(monitor_t *m, desktop_t *d)
empty_desktop(d);
free(d);
num_desktops--;
+ ewmh_update_current_desktop();
ewmh_update_number_of_desktops();
ewmh_update_desktop_names();
put_status();