Skip to content

Commit e711ae4

Browse files
committed
window.c: Make opacity a public property.
1 parent 8b059f6 commit e711ae4

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

src/core/window-private.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,6 @@ gboolean meta_window_has_transient_type (MetaWindow *window);
842842
void meta_window_set_transient_for (MetaWindow *window,
843843
MetaWindow *parent);
844844

845-
void meta_window_set_opacity (MetaWindow *window,
846-
guint8 opacity);
847-
848845
void meta_window_increase_opacity (MetaWindow *window);
849846
void meta_window_decrease_opacity (MetaWindow *window);
850847

src/core/window.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ enum
216216
PROP_PROGRESS,
217217
PROP_PROGRESS_PULSE,
218218
PROP_TILE_MODE,
219+
PROP_OPACITY,
219220
PROP_LAST,
220221
};
221222

@@ -447,6 +448,9 @@ meta_window_get_property(GObject *object,
447448
case PROP_TILE_MODE:
448449
g_value_set_enum (value, win->tile_mode);
449450
break;
451+
case PROP_OPACITY:
452+
g_value_set_uint (value, win->opacity);
453+
break;
450454
default:
451455
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
452456
break;
@@ -659,6 +663,15 @@ meta_window_class_init (MetaWindowClass *klass)
659663
META_TILE_NONE,
660664
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
661665

666+
obj_props[PROP_OPACITY] =
667+
g_param_spec_uint ("opacity",
668+
"Opacity",
669+
"The window's 'real' opacity (not the current opacity of the window actor",
670+
0,
671+
0xFF,
672+
0xFF,
673+
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
674+
662675
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
663676

664677
window_signals[WORKSPACE_CHANGED] =
@@ -8618,9 +8631,21 @@ void
86188631
meta_window_set_opacity (MetaWindow *window,
86198632
guint8 opacity)
86208633
{
8634+
g_return_if_fail (META_IS_WINDOW (window));
8635+
86218636
window->opacity = opacity;
86228637

86238638
meta_compositor_window_opacity_changed (window->display->compositor, window);
8639+
8640+
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_OPACITY]);
8641+
}
8642+
8643+
guint8
8644+
meta_window_get_opacity (MetaWindow *window)
8645+
{
8646+
g_return_val_if_fail (META_IS_WINDOW (window), 0xFF);
8647+
8648+
return window->opacity;
86248649
}
86258650

86268651
#define OPACITY_STEP 32

src/meta/window.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,11 @@ MetaWindowClientType meta_window_get_client_type (MetaWindow *window);
458458
META_EXPORT
459459
const char *meta_window_get_icon_name (MetaWindow *window);
460460

461+
META_EXPORT
462+
void meta_window_set_opacity (MetaWindow *window,
463+
guint8 opacity);
464+
465+
META_EXPORT
466+
guint8 meta_window_get_opacity (MetaWindow *window);
467+
461468
#endif

0 commit comments

Comments
 (0)