diff --git a/defaults/defaults b/defaults/defaults index 7202fd0f892dc2a8b5774bd19d9bfa17185d5861..807dec5a70fe0b8f27daaddd591d18f7a72055b0 100644 --- a/defaults/defaults +++ b/defaults/defaults @@ -14,6 +14,7 @@ focus_new=true full_width_title=true keytheme=Default move_opacity=100 +popup_opacity=90 placement_ratio=25 prevent_focus_stealing=false raise_delay=250 diff --git a/src/compositor.c b/src/compositor.c index fad0c43ba2ad5b099199db28ea6d80de66a4b065..2f2c27269b24ec33c1a2f63c25be91b7f63371ed 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1429,11 +1429,12 @@ unmap_win (CWindow *cw) } static void -add_win (DisplayInfo *display_info, Window id, Client *c, guint opacity) +add_win (DisplayInfo *display_info, Window id, Client *c) { ScreenInfo *screen_info = NULL; CWindow *new; - + guint opacity = (guint) NET_WM_OPAQUE; + TRACE ("entering add_win: 0x%lx", id); new = g_new0 (CWindow, 1); @@ -1450,6 +1451,7 @@ add_win (DisplayInfo *display_info, Window id, Client *c, guint opacity) if (c) { screen_info = c->screen_info; + opacity = c->opacity; } else { @@ -1476,6 +1478,8 @@ add_win (DisplayInfo *display_info, Window id, Client *c, guint opacity) { /* We must be notified of property changes for transparency, even if the win is not managed */ XSelectInput (display_info->dpy, id, new->attr.your_event_mask | PropertyChangeMask | StructureNotifyMask); + /* Set opacity for override redirects (aka popup windows) */ + opacity = (double) (screen_info->params->popup_opacity / 100.0) * NET_WM_OPAQUE; } /* Listen for XShape events if applicable */ @@ -2093,10 +2097,7 @@ compositorAddWindow (DisplayInfo *display_info, Window id, Client *c) } else { - guint opacity; - - opacity = ((c != NULL) ? c->opacity : NET_WM_OPAQUE); - add_win (display_info, id, c, opacity); + add_win (display_info, id, c); } #endif /* HAVE_COMPOSITOR */ } diff --git a/src/display.c b/src/display.c index 949ed08f20fde3752419a0c33d0c3e508520a1f9..3b177e439baf9f483f86f736343d2870546c28b8 100644 --- a/src/display.c +++ b/src/display.c @@ -597,6 +597,22 @@ myDisplayUpdateCurentTime (DisplayInfo *display, XEvent *ev) return display->current_time; } +ScreenInfo * +myDisplayGetDefaultScreen (DisplayInfo *display) +{ + GSList *index; + ScreenInfo *screen = NULL; + + g_return_val_if_fail (display != NULL, NULL); + + index = display->screens; + if (index) + { + screen = (ScreenInfo *) index->data; + } + return screen; +} + Time myDisplayGetCurrentTime (DisplayInfo *display) { diff --git a/src/settings.c b/src/settings.c index d80a5e4e84af8490d884c6f3bc45e07c90b387e6..dbda327078bd3ac3c0b0622d8c20e5ff090e4baf 100644 --- a/src/settings.c +++ b/src/settings.c @@ -367,6 +367,10 @@ notify_cb (const char *name, const char *channel_name, McsAction action, McsSett { screen_info->params->resize_opacity = setting->data.v_int; } + else if (!strcmp (name, "Xfwm/PopupOpacity")) + { + screen_info->params->popup_opacity = setting->data.v_int; + } else if (!strcmp (name, "Xfwm/PlacementRatio")) { screen_info->params->placement_ratio = setting->data.v_int; @@ -695,6 +699,12 @@ loadMcsData (ScreenInfo *screen_info, Settings *rc) setIntValueFromInt ("resize_opacity", setting->data.v_int, rc); mcs_setting_free (setting); } + if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PopupOpacity", CHANNEL5, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("popup_opacity", setting->data.v_int, rc); + mcs_setting_free (setting); + } if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowFrameShadow", CHANNEL5, &setting) == MCS_SUCCESS) { @@ -1222,6 +1232,7 @@ loadSettings (ScreenInfo *screen_info) {"margin_top", NULL, FALSE}, {"move_opacity", NULL, TRUE}, {"resize_opacity", NULL, TRUE}, + {"popup_opacity", NULL, TRUE}, {"placement_ratio", NULL, TRUE}, {"prevent_focus_stealing", NULL, TRUE}, {"raise_delay", NULL, TRUE}, @@ -1382,6 +1393,8 @@ loadSettings (ScreenInfo *screen_info) abs (TOINT (getValue ("move_opacity", rc))); screen_info->params->resize_opacity = abs (TOINT (getValue ("resize_opacity", rc))); + screen_info->params->popup_opacity = + abs (TOINT (getValue ("popup_opacity", rc))); screen_info->params->placement_ratio = abs (TOINT (getValue ("placement_ratio", rc))); screen_info->params->show_frame_shadow = diff --git a/src/settings.h b/src/settings.h index a627254b16e16e2f22200d4ca4a8657eed407a56..7dac3bbc051670eb39f4f02449bdb6a2888279d7 100644 --- a/src/settings.h +++ b/src/settings.h @@ -162,6 +162,7 @@ struct _XfwmParams int double_click_action; int move_opacity; int placement_ratio; + int popup_opacity; int raise_delay; int resize_opacity; int restore_on_move;