Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0279f43
Add RaiseTemp action.
Jan 16, 2008
1bec730
Add "de" option to Iconify action that makes it deiconify windows (us…
Jul 23, 2007
1ddd6c2
Make Unfocus do what the name says.
Feb 28, 2008
f50091b
Add FocusFallback action.
Mar 9, 2008
1e451ab
"Fix" releasing the mouse button over a window.
Mikachu Jan 8, 2010
81d4101
Add <menu><separateIconic> option
Mikachu Dec 29, 2022
ea74ade
Remove very old kde 3.5 ksplash call
Mikachu Dec 29, 2022
62bcd7b
Save screen_last_desktop to the root prop _OB_LAST_DESKTOP.
Feb 27, 2008
97a5e66
Normalize all incoming UTF-8 to NFC
Mikachu Aug 13, 2015
a36b481
Allow ignoring repeat events for a keybind
Mikachu Sep 16, 2016
87a34eb
Allow setting absolute font sizes with <type>absolute</type>
Mikachu Mar 12, 2018
2560a6e
Move anywhere if you can't resize the window
Mikachu Jan 29, 2019
b894c8a
Attempt to detect corrupted WM_NORMAL_HINTS
Mikachu Nov 2, 2019
635eda0
add focusable/nonfocusable to If action
Mikachu Feb 23, 2020
83550d2
Show the menu id instead of the failed command
Mikachu Oct 24, 2020
846ad73
Allow moving to the current desktop, to show the desktop popup
Oct 10, 2019
6238f61
Bring back "Show desktop switch popup on every monitor"
Oct 11, 2019
5213695
Sometimes after reconfigure we forget this, so check again
Mikachu May 20, 2022
8c5099b
Remove incorrect assertion for MoveResizeTo
Mikachu May 20, 2022
d41128e
Fix list traversal issue in client_calc_layer
pldubouilh Mar 17, 2023
ab35c14
Replace getgrent with getgroups. Fixes #5978.
Dec 15, 2015
8a576f9
Update german translation
msiism Mar 20, 2023
87050a2
Update slovak translation
jose1711 Mar 20, 2023
54dd345
Add bulgarian translation
mkkDr2010 Mar 20, 2023
9c26674
Update esperanto translation
keithbowes Mar 20, 2023
ec2ac7d
Update russian translation
glixx Mar 20, 2023
02e6d2f
gdm-control: Fix bad parenthesis placement for strncmp
dcb314 Mar 20, 2023
eded1e2
Fix incorrect free argument from d41128e5a1
Mikachu Jul 13, 2024
5cdadac
Replace deprecated functions and values
stderr64 Feb 4, 2025
821f13c
Removed no longer needed gboolean value and check for it
stderr64 Feb 4, 2025
4a36cba
Added missing debug.h include
stderr64 Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ openbox_openbox_SOURCES = \
openbox/actions/execute.c \
openbox/actions/exit.c \
openbox/actions/focus.c \
openbox/actions/focusfallback.c \
openbox/actions/focustobottom.c \
openbox/actions/fullscreen.c \
openbox/actions/growtoedge.c \
Expand All @@ -226,6 +227,7 @@ openbox_openbox_SOURCES = \
openbox/actions/omnipresent.c \
openbox/actions/raise.c \
openbox/actions/raiselower.c \
openbox/actions/raisetemp.c \
openbox/actions/reconfigure.c \
openbox/actions/resize.c \
openbox/actions/resizerelative.c \
Expand Down
8 changes: 4 additions & 4 deletions data/rc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
<keybind key="A-Escape">
<action name="Lower"/>
<action name="FocusToBottom"/>
<action name="Unfocus"/>
<action name="FocusFallback"/>
</keybind>
<keybind key="A-space">
<action name="ShowMenu"><menu>client-menu</menu></action>
Expand Down Expand Up @@ -347,7 +347,7 @@
<mousebind button="A-Middle" action="Press">
<action name="Lower"/>
<action name="FocusToBottom"/>
<action name="Unfocus"/>
<action name="FocusFallback"/>
</mousebind>

<mousebind button="A-Up" action="Click">
Expand Down Expand Up @@ -384,7 +384,7 @@
<then>
<action name="Shade"/>
<action name="FocusToBottom"/>
<action name="Unfocus"/>
<action name="FocusFallback"/>
<action name="Lower"/>
</then>
</action>
Expand All @@ -410,7 +410,7 @@
<mousebind button="Middle" action="Press">
<action name="Lower"/>
<action name="FocusToBottom"/>
<action name="Unfocus"/>
<action name="FocusFallback"/>
</mousebind>

<mousebind button="Right" action="Press">
Expand Down
5 changes: 4 additions & 1 deletion obrender/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size,
pango_font_description_set_family(out->font_desc, name);
pango_font_description_set_weight(out->font_desc, pweight);
pango_font_description_set_style(out->font_desc, pstyle);
pango_font_description_set_size(out->font_desc, size * PANGO_SCALE);
if (size < 0)
pango_font_description_set_absolute_size(out->font_desc, -size * PANGO_SCALE);
else
pango_font_description_set_size(out->font_desc, size * PANGO_SCALE);

/* setup the layout */
pango_layout_set_font_description(out->layout, out->font_desc);
Expand Down
34 changes: 19 additions & 15 deletions obrender/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static RrImagePic* RrImagePicNew(gint w, gint h, RrPixel32 *data)
RrImagePic *pic;

pic = g_slice_new(RrImagePic);
RrImagePicInit(pic, w, h, g_memdup(data, w*h*sizeof(RrPixel32)));
RrImagePicInit(pic, w, h, g_memdup2(data, (gsize)(w*h*sizeof(RrPixel32))));
return pic;
}

Expand Down Expand Up @@ -540,32 +540,36 @@ RsvgLoader* LoadWithRsvg(gchar *path,
{
RsvgLoader *loader = g_slice_new0(RsvgLoader);

if (!(loader->handle = rsvg_handle_new_from_file(path, NULL))) {
DestroyRsvgLoader(loader);
GFile *rsvg_handle_file = g_file_new_for_path( (const char*)path );
if ( rsvg_handle_new_from_gfile_sync(rsvg_handle_file, RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA, NULL, NULL) == NULL ){
DestroyRsvgLoader( loader );
g_object_unref( rsvg_handle_file );
return NULL;
}
g_object_unref( rsvg_handle_file );

if (!rsvg_handle_close(loader->handle, NULL)) {
DestroyRsvgLoader(loader);
if ( rsvg_handle_get_intrinsic_size_in_pixels(loader->handle, (gdouble*)width, (gdouble*)height) == FALSE ){
DestroyRsvgLoader( loader );
return NULL;
}

RsvgDimensionData dimension_data;
rsvg_handle_get_dimensions(loader->handle, &dimension_data);
*width = dimension_data.width;
*height = dimension_data.height;

loader->surface = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, *width, *height);

cairo_t* context = cairo_create(loader->surface);
gboolean success = rsvg_handle_render_cairo(loader->handle, context);
cairo_destroy(context);

if (!success) {
DestroyRsvgLoader(loader);
RsvgRectangle *rsvg_rect = g_slice_new0( RsvgRectangle );
rsvg_rect->x = 0;
rsvg_rect->y = 0;
rsvg_rect->width = *(gdouble*)width;
rsvg_rect->height = *(gdouble*)height;
if ( rsvg_handle_render_document(loader->handle, context, (const RsvgRectangle*)rsvg_rect, NULL) == FALSE ){
g_slice_free( RsvgRectangle, rsvg_rect );
cairo_destroy( context );
DestroyRsvgLoader( loader );
return NULL;
}
g_slice_free( RsvgRectangle, rsvg_rect );
cairo_destroy(context);

loader->pixel_data = g_new(guint32, *width * *height);

Expand Down
2 changes: 1 addition & 1 deletion obrender/instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ RrInstance* RrInstanceNew (Display *display, gint screen)
definst->depth = DefaultDepth(display, screen);
definst->visual = DefaultVisual(display, screen);
definst->colormap = DefaultColormap(display, screen);
definst->pango = pango_xft_get_context(display, screen);
definst->pango = pango_font_map_create_context( pango_xft_get_font_map(display, (int)screen) );

definst->pseudo_colors = NULL;

Expand Down
4 changes: 2 additions & 2 deletions obrender/mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RrPixmapMask *RrPixmapMaskNew(const RrInstance *inst,
m->width = w;
m->height = h;
/* round up to nearest byte */
m->data = g_memdup(data, (w + 7) / 8 * h);
m->data = g_memdup2(data, (gsize)((w + 7) / 8 * h));
m->mask = XCreateBitmapFromData(RrDisplay(inst), RrRootWindow(inst),
data, w, h);
return m;
Expand Down Expand Up @@ -75,7 +75,7 @@ RrPixmapMask *RrPixmapMaskCopy(const RrPixmapMask *src)
m->width = src->width;
m->height = src->height;
/* round up to nearest byte */
m->data = g_memdup(src->data, (src->width + 7) / 8 * src->height);
m->data = g_memdup2(src->data, (gsize)((src->width + 7) / 8 * src->height));
m->mask = XCreateBitmapFromData(RrDisplay(m->inst), RrRootWindow(m->inst),
m->data, m->width, m->height);
return m;
Expand Down
4 changes: 2 additions & 2 deletions obrender/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig)
spc->pixel_data = NULL;

copy->textures = orig->textures;
copy->texture = g_memdup(orig->texture,
orig->textures * sizeof(RrTexture));
copy->texture = g_memdup2(orig->texture,
(gsize)(orig->textures * sizeof(RrTexture)));
copy->pixmap = None;
copy->xftdraw = NULL;
copy->w = copy->h = 0;
Expand Down
2 changes: 1 addition & 1 deletion obrender/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ static RrPixel32* read_c_image(gint width, gint height, const guint8 *data)
RrPixel32 *im, *p;
gint i;

p = im = g_memdup(data, width * height * sizeof(RrPixel32));
p = im = g_memdup2(data, (gsize)(width * height * sizeof(RrPixel32)));

for (i = 0; i < width * height; ++i) {
guchar a = ((*p >> 24) & 0xff);
Expand Down
34 changes: 21 additions & 13 deletions obt/paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,33 @@ static void find_uid_gid(uid_t *u, gid_t **g, guint *n)
const gchar *name;
struct group *gr;

gid_t gmain;
gboolean maininc;
int i;

*u = getuid();
pw = getpwuid(*u);
name = pw->pw_name;

*g = g_new(gid_t, *n=1);
(*g)[0] = getgid();

while ((gr = getgrent())) {
if (gr->gr_gid != (*g)[0]) { /* skip the main group */
gchar **c;
for (c = gr->gr_mem; *c; ++c)
if (strcmp(*c, name) == 0) {
*g = g_renew(gid_t, *g, ++(*n)); /* save the group */
(*g)[*n-1] = gr->gr_gid;
break;
}
gmain = getgid();

*n = getgroups(0, *g);
*g = g_new(gid_t, *n);
*n = getgroups(*n, *g);

/* Check if the effective group ID of the calling process is already
included in the returned list. Add it otherwise. */
maininc = FALSE;
for (i = 0; i < *n; i++) {
if ( (*g)[i] == gmain ) {
maininc = TRUE;
break;
}
}
endgrent();
if (!maininc) {
*g = g_renew(gid_t, *g, ++(*n));
(*g)[*n-1] = gmain;
}

qsort(*g, *n, sizeof(gid_t), gid_cmp);
}
Expand Down
3 changes: 2 additions & 1 deletion obt/prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void obt_prop_startup(void)
CREATE_(OB_CONFIG_FILE);
CREATE_(OB_WM_ACTION_UNDECORATE);
CREATE_(OB_WM_STATE_UNDECORATED);
CREATE_(OB_LAST_DESKTOP);
CREATE_(OB_CONTROL);
CREATE_(OB_VERSION);
CREATE_(OB_APP_ROLE);
Expand Down Expand Up @@ -407,7 +408,7 @@ static void* convert_text_property(XTextProperty *tprop,
const gchar *end; /* the first byte past the valid data */

g_utf8_validate(retlist[i], -1, &end);
retlist[i] = g_strndup(retlist[i], end-retlist[i]);
retlist[i] = g_utf8_normalize(retlist[i], end-retlist[i], G_NORMALIZE_NFC);
}
else if (encoding == LOCALE) {
gsize nvalid; /* the number of valid bytes at the front of the
Expand Down
1 change: 1 addition & 0 deletions obt/prop.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ typedef enum {
OBT_PROP_OPENBOX_PID, /* this is depreecated in favour of ob_control */
OBT_PROP_OB_THEME,
OBT_PROP_OB_CONFIG_FILE,
OBT_PROP_OB_LAST_DESKTOP,
OBT_PROP_OB_CONTROL,
OBT_PROP_OB_VERSION,
OBT_PROP_OB_APP_ROLE,
Expand Down
2 changes: 2 additions & 0 deletions openbox/actions/all.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ void action_all_startup(void)
action_move_startup();
action_focus_startup();
action_raise_startup();
action_raisetemp_startup();
action_lower_startup();
action_raiselower_startup();
action_unfocus_startup();
action_focusfallback_startup();
action_iconify_startup();
action_fullscreen_startup();
action_maximize_startup();
Expand Down
2 changes: 2 additions & 0 deletions openbox/actions/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ void action_close_startup(void);
void action_move_startup(void);
void action_focus_startup(void);
void action_raise_startup(void);
void action_raisetemp_startup(void);
void action_lower_startup(void);
void action_raiselower_startup(void);
void action_unfocus_startup(void);
void action_focusfallback_startup(void);
void action_iconify_startup(void);
void action_fullscreen_startup(void);
void action_maximize_startup(void);
Expand Down
4 changes: 1 addition & 3 deletions openbox/actions/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
g_assert_not_reached();
}

if (d < screen_num_desktops &&
(d != screen_desktop ||
(data->client && data->client->desktop != screen_desktop))) {
if (d < screen_num_desktops) {
gboolean go = TRUE;

actions_client_move(data, TRUE);
Expand Down
3 changes: 2 additions & 1 deletion openbox/actions/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ static gboolean run_func(ObActionsData *data, gpointer options)

/* If there is a keyboard grab going on then we need to cancel
it so the application can grab things */
if (data->uact != OB_USER_ACTION_MENU_SELECTION)
if (data->uact != OB_USER_ACTION_MENU_SELECTION &&
data->uact != OB_USER_ACTION_KEYBOARD_KEY_NO_REPEAT)
event_cancel_all_key_grabs();

e = NULL;
Expand Down
17 changes: 17 additions & 0 deletions openbox/actions/focusfallback.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "openbox/actions.h"
#include "openbox/focus.h"

static gboolean run_func(ObActionsData *data, gpointer options);

void action_focusfallback_startup(void)
{
actions_register("FocusFallback", NULL, NULL, run_func);
}

/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
if (data->client && data->client == focus_client)
focus_fallback(FALSE, FALSE, TRUE, FALSE);
return FALSE;
}
16 changes: 14 additions & 2 deletions openbox/actions/iconify.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@
#include "openbox/client.h"

static gboolean run_func(ObActionsData *data, gpointer options);
static gpointer setup_func(xmlNodePtr node);

void action_iconify_startup(void)
{
actions_register("Iconify",
NULL, NULL,
setup_func,
NULL,
run_func);
}

static gpointer setup_func(xmlNodePtr node)
{
xmlNodePtr n;

if ((n = obt_xml_find_node(node, "de")))
return GINT_TO_POINTER(obt_xml_node_bool(n));

return GINT_TO_POINTER(0);
}

/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
if (data->client) {
actions_client_move(data, TRUE);
client_iconify(data->client, TRUE, TRUE, FALSE);
client_iconify(data->client, !options, TRUE, FALSE);
actions_client_move(data, FALSE);
}

Expand Down
10 changes: 9 additions & 1 deletion openbox/actions/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ typedef struct {
gboolean fullscreen_off;
gboolean focused;
gboolean unfocused;
gboolean focusable;
gboolean nonfocusable;
gboolean urgent_on;
gboolean urgent_off;
gboolean decor_off;
Expand Down Expand Up @@ -162,7 +164,7 @@ static gboolean check_typed_match(TypedMatch *tm, const gchar *s)
{
switch (tm->type) {
case MATCH_TYPE_PATTERN:
return g_pattern_match_string(tm->m.pattern, s);
return g_pattern_spec_match_string((GPatternSpec*)tm->m.pattern, s);
case MATCH_TYPE_REGEX:
return g_regex_match(tm->m.regex, s, 0, NULL);
case MATCH_TYPE_EXACT:
Expand All @@ -186,6 +188,7 @@ static void setup_query(Options* o, xmlNodePtr node, QueryTarget target) {
set_bool(node, "iconified", &q->iconic_on, &q->iconic_off);
set_bool(node, "fullscreen", &q->fullscreen_on, &q->fullscreen_off);
set_bool(node, "focused", &q->focused, &q->unfocused);
set_bool(node, "focusable", &q->focusable, &q->nonfocusable);
set_bool(node, "urgent", &q->urgent_on, &q->urgent_off);
set_bool(node, "undecorated", &q->decor_off, &q->decor_on);
set_bool(node, "omnipresent", &q->omnipresent_on, &q->omnipresent_off);
Expand Down Expand Up @@ -376,6 +379,11 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
if (q->unfocused)
is_true &= query_target != focus_client;

if (q->focusable)
is_true &= query_target->can_focus;
if (q->nonfocusable)
is_true &= !query_target->can_focus;

gboolean is_urgent =
query_target->urgent || query_target->demands_attention;
if (q->urgent_on)
Expand Down
2 changes: 1 addition & 1 deletion openbox/actions/moveresizeto.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
case PREV_MONITOR:
mon = (cmon == 0) ? (screen_num_monitors - 1) : (cmon - 1); break;
default:
g_assert_not_reached();
/* desktop specified by number */
}

area = screen_area(c->desktop, mon, NULL);
Expand Down
Loading