1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 client.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
19 #include "per_app_settings.h"
23 ObAppSetting *get_client_settings(ObClient *client)
25 GSList *a = config_per_app_settings;
28 ObAppSetting *app = (ObAppSetting *) a->data;
30 if (!strcmp(app->name, client->name)) {
31 ob_debug("Window matching: %s\n", app->name);
33 return (ObAppSetting *) a->data;
41 void place_window_from_settings(ObAppSetting *setting, ObClient *client, gint *x, gint *y)
46 /* Find which head the pointer is on, partly taken from place.c */
47 if (setting->head == -1) {
48 screen_pointer_pos(&px, &py);
50 for (i = 0; i < screen_num_monitors; i++) {
51 screen = screen_area_monitor(client->desktop, i);
52 if (RECT_CONTAINS(*screen, px, py))
56 if (i == screen_num_monitors)
57 screen = screen_area_monitor(client->desktop, 0);
60 screen = screen_area_monitor(client->desktop, setting->head);
62 if (setting->position.x == -1 && setting->center_x)
63 *x = screen->x + screen->width / 2 - client->area.width / 2;
64 else if (setting->position.x != -1)
65 *x = screen->x + setting->position.x;
67 if (setting->position.y == -1 && setting->center_y)
68 *y = screen->y + screen->height / 2 - client->area.height / 2;
69 else if (setting->position.y != -1)
70 *y = screen->y + setting->position.y;