summaryrefslogtreecommitdiff
path: root/src/core/iconcache.h
blob: 11dc66176ccc393a307145eb472b5048a6735708 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/* Marco window icons */

/*
 * Copyright (C) 2002 Havoc Pennington
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef META_ICON_CACHE_H
#define META_ICON_CACHE_H

#include "screen-private.h"

typedef struct _MetaIconCache MetaIconCache;

typedef enum
{
  /* These MUST be in ascending order of preference;
   * i.e. if we get _NET_WM_ICON and already have
   * WM_HINTS, we prefer _NET_WM_ICON
   */
  USING_NO_ICON,
  USING_FALLBACK_ICON,
  USING_KWM_WIN_ICON,
  USING_WM_HINTS,
  USING_NET_WM_ICON
} IconOrigin;

struct _MetaIconCache
{
  int origin;
  Pixmap prev_pixmap;
  Pixmap prev_mask;
  guint want_fallback : 1;
  /* TRUE if these props have changed */
  guint wm_hints_dirty : 1;
  guint kwm_win_icon_dirty : 1;
  guint net_wm_icon_dirty : 1;

  guint wm_hints_dirty_forced : 1;
  guint kwm_win_icon_dirty_forced : 1;
  guint fallback_icon_dirty_forced : 1;
};

void           meta_icon_cache_init                 (MetaIconCache *icon_cache);
void           meta_icon_cache_free                 (MetaIconCache *icon_cache);
void           meta_icon_cache_invalidate           (MetaIconCache *icon_cache);
void           meta_icon_cache_property_changed     (MetaIconCache *icon_cache,
                                                     MetaDisplay   *display,
                                                     Atom           atom);
gboolean       meta_icon_cache_get_icon_invalidated (MetaIconCache *icon_cache);

gboolean meta_read_icons         (MetaScreen       *screen,
                                  Window            xwindow,
                                  char             *res_name,
                                  MetaIconCache    *icon_cache,
                                  Pixmap            wm_hints_pixmap,
                                  Pixmap            wm_hints_mask,
                                  cairo_surface_t **iconp,
                                  int               ideal_size,
                                  cairo_surface_t **mini_iconp,
                                  int               ideal_mini_size,
                                  int               scaling_factor);

#endif