client: store size hints
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
01f37e1edc
commit
34d49ac4ee
52
client.c
52
client.c
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_atom.h>
|
#include <xcb/xcb_atom.h>
|
||||||
#include <xcb/xcb_icccm.h>
|
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -875,67 +874,64 @@ client_updatewmhints(client_t *c)
|
||||||
|
|
||||||
/** Update the size hints of a client.
|
/** Update the size hints of a client.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \return A pointer to a xcb_size_hints_t.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
client_updatesizehints(client_t *c)
|
client_updatesizehints(client_t *c)
|
||||||
{
|
{
|
||||||
xcb_size_hints_t size_hints;
|
|
||||||
|
|
||||||
if(!xcb_get_wm_normal_hints_reply(globalconf.connection,
|
if(!xcb_get_wm_normal_hints_reply(globalconf.connection,
|
||||||
xcb_get_wm_normal_hints_unchecked(globalconf.connection,
|
xcb_get_wm_normal_hints_unchecked(globalconf.connection,
|
||||||
c->win),
|
c->win),
|
||||||
&size_hints, NULL))
|
&c->size_hints, NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((size_hints.flags & XCB_SIZE_HINT_P_SIZE))
|
if((c->size_hints.flags & XCB_SIZE_HINT_P_SIZE))
|
||||||
{
|
{
|
||||||
c->basew = size_hints.base_width;
|
c->basew = c->size_hints.base_width;
|
||||||
c->baseh = size_hints.base_height;
|
c->baseh = c->size_hints.base_height;
|
||||||
}
|
}
|
||||||
else if((size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
else if((c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
||||||
{
|
{
|
||||||
c->basew = size_hints.min_width;
|
c->basew = c->size_hints.min_width;
|
||||||
c->baseh = size_hints.min_height;
|
c->baseh = c->size_hints.min_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->basew = c->baseh = 0;
|
c->basew = c->baseh = 0;
|
||||||
|
|
||||||
if((size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC))
|
if((c->size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC))
|
||||||
{
|
{
|
||||||
c->incw = size_hints.width_inc;
|
c->incw = c->size_hints.width_inc;
|
||||||
c->inch = size_hints.height_inc;
|
c->inch = c->size_hints.height_inc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->incw = c->inch = 0;
|
c->incw = c->inch = 0;
|
||||||
|
|
||||||
if((size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE))
|
if((c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE))
|
||||||
{
|
{
|
||||||
c->maxw = size_hints.max_width;
|
c->maxw = c->size_hints.max_width;
|
||||||
c->maxh = size_hints.max_height;
|
c->maxh = c->size_hints.max_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->maxw = c->maxh = 0;
|
c->maxw = c->maxh = 0;
|
||||||
|
|
||||||
if((size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
if((c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
||||||
{
|
{
|
||||||
c->minw = size_hints.min_width;
|
c->minw = c->size_hints.min_width;
|
||||||
c->minh = size_hints.min_height;
|
c->minh = c->size_hints.min_height;
|
||||||
}
|
}
|
||||||
else if((size_hints.flags & XCB_SIZE_HINT_BASE_SIZE))
|
else if((c->size_hints.flags & XCB_SIZE_HINT_BASE_SIZE))
|
||||||
{
|
{
|
||||||
c->minw = size_hints.base_width;
|
c->minw = c->size_hints.base_width;
|
||||||
c->minh = size_hints.base_height;
|
c->minh = c->size_hints.base_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->minw = c->minh = 0;
|
c->minw = c->minh = 0;
|
||||||
|
|
||||||
if((size_hints.flags & XCB_SIZE_HINT_P_ASPECT))
|
if((c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT))
|
||||||
{
|
{
|
||||||
c->minax = size_hints.min_aspect_num;
|
c->minax = c->size_hints.min_aspect_num;
|
||||||
c->minay = size_hints.min_aspect_den;
|
c->minay = c->size_hints.min_aspect_den;
|
||||||
c->maxax = size_hints.max_aspect_num;
|
c->maxax = c->size_hints.max_aspect_num;
|
||||||
c->maxay = size_hints.max_aspect_den;
|
c->maxay = c->size_hints.max_aspect_den;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->minax = c->maxax = c->minay = c->maxay = 0;
|
c->minax = c->maxax = c->minay = c->maxay = 0;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#define AWESOME_STRUCTS_H
|
#define AWESOME_STRUCTS_H
|
||||||
|
|
||||||
#include <xcb/xcb_event.h>
|
#include <xcb/xcb_event.h>
|
||||||
|
#include <xcb/xcb_icccm.h>
|
||||||
#include <ev.h>
|
#include <ev.h>
|
||||||
|
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
@ -315,6 +316,8 @@ struct client_t
|
||||||
button_array_t buttons;
|
button_array_t buttons;
|
||||||
/** Icon */
|
/** Icon */
|
||||||
netwm_icon_t *icon;
|
netwm_icon_t *icon;
|
||||||
|
/** Size hints */
|
||||||
|
xcb_size_hints_t size_hints;
|
||||||
/** Next and previous clients */
|
/** Next and previous clients */
|
||||||
client_t *prev, *next;
|
client_t *prev, *next;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue