Skip to content

Commit

Permalink
muffin: Use glib for gettext
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Jan 14, 2020
1 parent e3eaf72 commit a452ec9
Show file tree
Hide file tree
Showing 28 changed files with 77 additions and 41 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -13015,7 +13015,7 @@ Mon Jun 3 15:12:11 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>

Patch from Erwann Chenede for raise_or_lower keybinding

* src/display.c, src/common.h: POINT_IN_RECT moved to a common
* src/display.c, src/common.h: META_POINT_IN_RECT moved to a common
location, removed from here
(meta_rectangle_intersect): move here and make it public

Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ libmuffin_la_SOURCES = \
core/stack-tracker.h \
core/util.c \
meta/util.h \
meta/util-private.h \
core/window-props.c \
core/window-props.h \
core/window.c \
Expand Down Expand Up @@ -281,7 +282,7 @@ Meta-$(api_version).gir: libmuffin.la
muffin-enum-types.h \
$(libmuffininclude_base_headers) \
$(filter %.c,$(libmuffin_la_SOURCES))
@META_GIR@_SCANNERFLAGS = $(WARN_SCANNERFLAGS) --warn-all --warn-error
@META_GIR@_SCANNERFLAGS = $(WARN_SCANNERFLAGS) --warn-all --warn-error --identifier-prefix=Meta

endif

Expand Down
1 change: 1 addition & 0 deletions src/compositor/compositor.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include "meta-background-actor-private.h"
#include "window-private.h" /* to check window->hidden */
#include "display-private.h" /* for meta_display_lookup_x_window() */
#include "util-private.h"
#include <X11/extensions/shape.h>
#include <X11/extensions/Xcomposite.h>
#include "meta-sync-ring.h"
Expand Down
1 change: 1 addition & 0 deletions src/compositor/meta-background.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <clutter/clutter.h>
#include "cogl-utils.h"
#include <meta/errors.h>
// #include "util-private.h"
#include "meta-background-actor-private.h"

struct _MetaBackgroundPrivate
Expand Down
8 changes: 3 additions & 5 deletions src/compositor/plugins/default.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
* Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
* 02110-1335, USA.
*/

#include <config.h>
#include <meta/meta-plugin.h>
#include <meta/window.h>

#include <libintl.h>
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x

#include <meta/util.h>
#include <glib/gi18n-lib.h>
#include <clutter/clutter.h>
#include <gmodule.h>
#include <string.h>
Expand Down
1 change: 1 addition & 0 deletions src/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "workspace-private.h"
#include <meta/prefs.h>
#include <meta/errors.h>
#include "util-private.h"

/* Looks up the MetaWindow representing the frame of the given X window.
* Used as a helper function by a bunch of the functions below.
Expand Down
2 changes: 1 addition & 1 deletion src/core/delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define _XOPEN_SOURCE /* for kill() */

#include <config.h>
#include <meta/util.h>
#include "util-private.h"
#include "window-private.h"
#include <meta/errors.h>
#include <meta/workspace.h>
Expand Down
4 changes: 2 additions & 2 deletions src/core/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,8 +1568,8 @@ window_raise_with_delay_callback (void *data)
meta_error_trap_pop (window->display);

point_in_window =
(window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) ||
(window->frame == NULL && POINT_IN_RECT (root_x, root_y, window->rect));
(window->frame && META_POINT_IN_RECT (root_x, root_y, window->frame->rect)) ||
(window->frame == NULL && META_POINT_IN_RECT (root_x, root_y, window->rect));
if (same_screen && point_in_window)
meta_window_raise (window);
#ifdef WITH_VERBOSE_MODE
Expand Down
2 changes: 1 addition & 1 deletion src/core/keybindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "frame.h"
#include "place.h"
#include <meta/prefs.h>
#include <meta/util.h>
#include "util-private.h"

#include <X11/keysym.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#include <config.h>
#include <meta/main.h>
#include <meta/util.h>
#include "util-private.h"
#include "display-private.h"
#include <meta/errors.h>
#include "ui.h"
Expand Down
1 change: 1 addition & 0 deletions src/core/muffin.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <meta/main.h>
#include <meta/util.h>
#include "meta-plugin-manager.h"
#include <glib/gi18n-lib.h>

#include <glib.h>

Expand Down
2 changes: 1 addition & 1 deletion src/core/prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <config.h>
#include <meta/prefs.h>
#include "ui.h"
#include <meta/util.h>
#include "util-private.h"
#include "meta-plugin-manager.h"
#include <glib.h>
#include <gio/gio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/core/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <config.h>
#include "screen-private.h"
#include <meta/main.h>
#include <meta/util.h>
#include "util-private.h"
#include <meta/errors.h>
#include "window-private.h"
#include "frame.h"
Expand Down
1 change: 1 addition & 0 deletions src/core/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <config.h>

#include "util-private.h"
#include "session.h"
#include <X11/Xatom.h>

Expand Down
2 changes: 1 addition & 1 deletion src/core/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ window_contains_point (MetaWindow *window,

meta_window_get_outer_rect (window, &rect);

return POINT_IN_RECT (root_x, root_y, rect);
return META_POINT_IN_RECT (root_x, root_y, rect);
}

static MetaWindow*
Expand Down
36 changes: 36 additions & 0 deletions src/core/util-private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/* Mutter utilities */

/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2005 Elijah Newren
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/

#ifndef META_UTIL_PRIVATE_H
#define META_UTIL_PRIVATE_H

#include <meta/util.h>
#include <glib/gi18n-lib.h>

void meta_set_verbose (gboolean setting);
void meta_set_debugging (gboolean setting);
void meta_set_syncing (gboolean setting);
void meta_set_replace_current_wm (gboolean setting);

#endif
2 changes: 1 addition & 1 deletion src/core/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include <config.h>
#include <meta/common.h>
#include <meta/util.h>
#include "util-private.h"
#include <meta/main.h>

#include <clutter/clutter.h> /* For clutter_threads_add_repaint_func() */
Expand Down
1 change: 1 addition & 0 deletions src/core/window-props.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <X11/Xatom.h>
#include <unistd.h>
#include <string.h>
#include "util-private.h"
#ifndef HOST_NAME_MAX
/* Solaris headers apparently don't define this so do so manually; #326745 */
#define HOST_NAME_MAX 255
Expand Down
2 changes: 1 addition & 1 deletion src/core/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "window-private.h"
#include "boxes-private.h"
#include "edge-resistance.h"
#include <meta/util.h>
#include "util-private.h"
#include "frame.h"
#include <meta/errors.h>
#include "workspace-private.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/xprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ from The Open Group.
#include <config.h>
#include "xprops.h"
#include <meta/errors.h>
#include <meta/util.h>
#include "util-private.h"
#include "async-getprop.h"
#include "ui.h"
#include "muffin-Xatomtype.h"
Expand Down
2 changes: 1 addition & 1 deletion src/meta/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void meta_frame_borders_clear (MetaFrameBorders *self);

/************************************************************/

#define POINT_IN_RECT(xcoord, ycoord, rect) \
#define META_POINT_IN_RECT(xcoord, ycoord, rect) \
((xcoord) >= (rect).x && \
(xcoord) < ((rect).x + (rect).width) && \
(ycoord) >= (rect).y && \
Expand Down
5 changes: 0 additions & 5 deletions src/meta/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@
#include <meta/common.h>

gboolean meta_is_verbose (void);
void meta_set_verbose (gboolean setting);
gboolean meta_is_debugging (void);
void meta_set_debugging (gboolean setting);
gboolean meta_is_syncing (void);
void meta_set_syncing (gboolean setting);
void meta_set_replace_current_wm (gboolean setting);

void meta_debug_spew_real (const char *format,
...) G_GNUC_PRINTF (1, 2);
Expand Down Expand Up @@ -97,7 +93,6 @@ const char* meta_gravity_to_string (int gravity);

#include <libintl.h>
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x

char* meta_g_utf8_strndup (const gchar *src, gsize n);

Expand Down
24 changes: 12 additions & 12 deletions src/ui/frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -2495,16 +2495,16 @@ get_control (MetaFrames *frames,
meta_frames_calc_geometry (frames, frame, &fgeom);
get_client_rect (&fgeom, fgeom.width, fgeom.height, &client);

if (POINT_IN_RECT (x, y, client))
if (META_POINT_IN_RECT (x, y, client))
return META_FRAME_CONTROL_CLIENT_AREA;

if (POINT_IN_RECT (x, y, fgeom.close_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.close_rect.clickable))
return META_FRAME_CONTROL_DELETE;

if (POINT_IN_RECT (x, y, fgeom.min_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.min_rect.clickable))
return META_FRAME_CONTROL_MINIMIZE;

if (POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
return META_FRAME_CONTROL_MENU;

meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
Expand All @@ -2521,15 +2521,15 @@ get_control (MetaFrames *frames,
has_right = (flags & META_FRAME_ALLOWS_RIGHT_RESIZE) != 0;
has_bottom = (flags & META_FRAME_ALLOWS_BOTTOM_RESIZE) != 0;

if (POINT_IN_RECT (x, y, fgeom.title_rect))
if (META_POINT_IN_RECT (x, y, fgeom.title_rect))
{
if (has_vert && y <= TOP_RESIZE_HEIGHT && has_north_resize)
return META_FRAME_CONTROL_RESIZE_N;
else
return META_FRAME_CONTROL_TITLE;
}

if (POINT_IN_RECT (x, y, fgeom.max_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.max_rect.clickable))
{
if (flags & META_FRAME_MAXIMIZED &&
(META_WINDOW_TILED_TOP (window) ||
Expand All @@ -2542,32 +2542,32 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_MAXIMIZE;
}

if (POINT_IN_RECT (x, y, fgeom.shade_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.shade_rect.clickable))
{
return META_FRAME_CONTROL_SHADE;
}

if (POINT_IN_RECT (x, y, fgeom.unshade_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.unshade_rect.clickable))
{
return META_FRAME_CONTROL_UNSHADE;
}

if (POINT_IN_RECT (x, y, fgeom.above_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.above_rect.clickable))
{
return META_FRAME_CONTROL_ABOVE;
}

if (POINT_IN_RECT (x, y, fgeom.unabove_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.unabove_rect.clickable))
{
return META_FRAME_CONTROL_UNABOVE;
}

if (POINT_IN_RECT (x, y, fgeom.stick_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.stick_rect.clickable))
{
return META_FRAME_CONTROL_STICK;
}

if (POINT_IN_RECT (x, y, fgeom.unstick_rect.clickable))
if (META_POINT_IN_RECT (x, y, fgeom.unstick_rect.clickable))
{
return META_FRAME_CONTROL_UNSTICK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <string.h>
#include "menu.h"
#include <meta/main.h>
#include <meta/util.h>
#include "util-private.h"
#include "core.h"
#include "metaaccellabel.h"
#include "ui.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ui/metaaccellabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "metaaccellabel.h"
#include <gtk/gtk.h>
#include <string.h>
#include <meta/util.h>
#include "util-private.h"

static void meta_accel_label_destroy (GtkWidget *object);
static void meta_accel_label_finalize (GObject *object);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/resizepopup.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <config.h>
#include "resizepopup.h"
#include <meta/util.h>
#include "util-private.h"
#include <gtk/gtk.h>
#include <gdk/gdkx.h>

Expand Down
2 changes: 1 addition & 1 deletion src/ui/theme-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <config.h>
#include "theme-private.h"
#include <meta/util.h>
#include "util-private.h"
#include <meta/prefs.h>
#include <string.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

#include <config.h>
#include "theme-private.h"
#include <meta/util.h>
#include "util-private.h"
#include <meta/gradient.h>
#include <meta/prefs.h>
#include <gtk/gtk.h>
Expand Down

0 comments on commit a452ec9

Please sign in to comment.