Example #1
0
/*
 * update_shadow
 * Returns: 1 for success, 0 for failure
 * Description: creates a libdecoration shadow context and updates
 * the decoration context for the shadow for the properties that we
 * have already read from the root window.
 *
 * For the pixmap mode we have opt_shadow which is passed to
 * decor_shadow_create (which contains the shadow settings from
 * the root window)
 *
 * For the reparenting mode we always enforce a zero-shadow in
 * the opt_no_shadow passed to decor_shadow_create.
 *
 * We do something similar  for the maximimzed mode as well
 */
void
bare_frame_update_shadow (Display		  *xdisplay,
			   Screen		  *screen,
			   decor_frame_t	  *frame,
			   decor_shadow_t	  **shadow_normal,
			   decor_context_t	  *context_normal,
			   decor_shadow_t	  **shadow_max,
			   decor_context_t	  *context_max,
			   decor_shadow_info_t    *info,
			   decor_shadow_options_t *opt_shadow,
			   decor_shadow_options_t *opt_no_shadow)
{
    if (frame->border_shadow_active)
    {
	decor_shadow_destroy (xdisplay, frame->border_shadow_active);
	frame->border_shadow_active = NULL;
    }

    frame->border_shadow_active = decor_shadow_create (xdisplay,
					    screen,
					    1, 1,
					    0,
					    0,
					    0,
					    0,
					    0, 0, 0, 0,
					    opt_shadow,
					    &frame->window_context_active,
					    decor_draw_simple,
					    NULL);
}
Example #2
0
void
KWD::Decorator::updateShadow (void)
{
    Display	    *xdisplay = QX11Info::display ();
    Screen	    *xscreen;
    decor_context_t context;

    xscreen = ScreenOfDisplay (xdisplay, QX11Info::appScreen ());

    if (mNoBorderShadow)
	decor_shadow_destroy (xdisplay, mNoBorderShadow);

    mNoBorderShadow = decor_shadow_create (xdisplay,
					   xscreen,
					   1, 1,
					   0,
					   0,
					   0,
					   0,
					   0, 0, 0, 0,
					   &mActiveShadowOptions,
					   &context,
					   decor_draw_simple,
					   0);

    if (mNoBorderShadow)
    {
	decor_extents_t extents = { 0, 0, 0, 0 };
	long	        *data;
	unsigned int    n = 1, frame_type = 0, frame_state = 0, frame_actions = 0;
	decor_quad_t    quads[N_QUADS_MAX];
	int	        nQuad;
	decor_layout_t  layout;

	decor_get_default_layout (&context, 1, 1, &layout);

	nQuad = decor_set_lSrStSbS_window_quads (quads, &context, &layout);

	data = decor_alloc_property (n, WINDOW_DECORATION_TYPE_PIXMAP);
	decor_quads_to_property (data, n - 1, mNoBorderShadow->pixmap,
				 &extents, &extents, &extents, &extents,
				 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);

	KWD::trapXError ();
	XChangeProperty (QX11Info::display (), QX11Info::appRootWindow (),
			 Atoms::netWindowDecorBare,
			 XA_INTEGER,
			 32, PropModeReplace, (unsigned char *) data,
			 PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
	KWD::popXError ();

        free (data);
    }
}
Example #3
0
void
switcher_frame_update_shadow (Display		  *xdisplay,
			      Screen		  *screen,
			      decor_frame_t	  *frame,
			      decor_shadow_t	  **shadow_normal,
			      decor_context_t	  *context_normal,
			      decor_shadow_t	  **shadow_max,
			      decor_context_t	  *context_max,
			      decor_shadow_info_t    *info,
			      decor_shadow_options_t *opt_shadow,
			      decor_shadow_options_t *opt_no_shadow)
{
    if (frame->border_shadow_active)
    {
	decor_shadow_destroy (xdisplay, frame->border_shadow_active);
	frame->border_shadow_active = NULL;
    }

    frame->border_shadow_active = decor_shadow_create (xdisplay,
						screen,
						1, 1,
						frame->win_extents.left,
						frame->win_extents.right,
						frame->win_extents.top,
						frame->win_extents.bottom,
						frame->win_extents.left -
						TRANSLUCENT_CORNER_SIZE,
						frame->win_extents.right -
						TRANSLUCENT_CORNER_SIZE,
						frame->win_extents.top -
						TRANSLUCENT_CORNER_SIZE,
						frame->win_extents.bottom -
						TRANSLUCENT_CORNER_SIZE,
						opt_shadow,
						&frame->window_context_active,
						decor_draw_simple,
						NULL);
}
Example #4
0
void
decor_frame_update_shadow (Display		  *xdisplay,
			   Screen		  *screen,
			   decor_frame_t	  *frame,
			   decor_shadow_t	  **shadow_normal,
			   decor_context_t	  *context_normal,
			   decor_shadow_t	  **shadow_max,
			   decor_context_t	  *context_max,
			   decor_shadow_info_t    *info,
			   decor_shadow_options_t *opt_shadow,
			   decor_shadow_options_t *opt_no_shadow)
{
    if (*shadow_normal)
    {
	decor_shadow_destroy (xdisplay, *shadow_normal);
	*shadow_normal = NULL;
    }

    /*
     * Warning: decor_shadow_create does more than return a decor_shadow_t*
     *          It also has to be called to populate the context parameter
     *          (third last parameter). So even if you don't want a shadow
     *          then you still need to call decor_shadow_create :(
     */
    *shadow_normal = decor_shadow_create (xdisplay,
						 screen,
						 1, 1,
						 frame->win_extents.left,
						 frame->win_extents.right,
						 frame->win_extents.top + frame->titlebar_height,
						 frame->win_extents.bottom,
						 frame->win_extents.left -
						 TRANSLUCENT_CORNER_SIZE,
						 frame->win_extents.right -
						 TRANSLUCENT_CORNER_SIZE,
						 frame->win_extents.top + frame->titlebar_height -
						 TRANSLUCENT_CORNER_SIZE,
						 frame->win_extents.bottom -
						 TRANSLUCENT_CORNER_SIZE,
						 opt_shadow,
						 context_normal,
						 draw_border_shape,
						 (void *) info);

    /* Maximized border shadow pixmap mode */
    if (*shadow_max)
    {
	decor_shadow_destroy (xdisplay, *shadow_max);
	*shadow_max = NULL;
    }

    info->state = (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
		   WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY);

    *shadow_max =
	decor_shadow_create (xdisplay,
			     screen,
			     1, 1,
			     frame->max_win_extents.left,
			     frame->max_win_extents.right,
			     frame->max_win_extents.top + frame->max_titlebar_height,
			     frame->max_win_extents.bottom,
			     frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
			     frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
			     frame->max_win_extents.top + frame->max_titlebar_height -
			     TRANSLUCENT_CORNER_SIZE,
			     frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
			     opt_no_shadow,  /* No shadow when maximized */
			     context_max,
			     draw_border_shape,
			     (void *) info);

    /* Reset info->state */
    info->state = 0;
}