summaryrefslogtreecommitdiff
path: root/src/core/util-private.h
blob: d6af275b3c1cb5d79a27b67e16628f8c3a19e457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -*- 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 <glib/gi18n-lib.h>

#include "meta/util.h"
#include "meta/common.h"

/* META_EXPORT_TEST should be used to export symbols that are exported only
 * for testability purposes */
#define META_EXPORT_TEST META_EXPORT

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

void     meta_set_is_wayland_compositor (gboolean setting);

char *   meta_generate_random_id (GRand *rand,
                                  int    length);

void meta_init_debug_utils (void);

#define META_POINT_IN_RECT(xcoord, ycoord, rect) \
  ((xcoord) >= (rect).x &&                   \
   (xcoord) <  ((rect).x + (rect).width) &&  \
   (ycoord) >= (rect).y &&                   \
   (ycoord) <  ((rect).y + (rect).height))

#define META_CONTAINER_OF(ptr, type, member) \
  (type *) ((uint8_t *) (ptr) - G_STRUCT_OFFSET (type, member))

#endif