Example #1
0
void
clientwin_unmap(ClientWin *cw)
{
	if(cw->damage)
	{
		XDamageDestroy(cw->mainwin->dpy, cw->damage);
		cw->damage = None;
	}
	
	if(cw->destination)
	{
		XRenderFreePicture(cw->mainwin->dpy, cw->destination);
		cw->destination = None;
	}
	
	if(cw->pixmap)
	{
		XFreePixmap(cw->mainwin->dpy, cw->pixmap);
		cw->pixmap = None;
	}
	
	XUnmapWindow(cw->mainwin->dpy, cw->mini.window);
	XSetWindowBackgroundPixmap(cw->mainwin->dpy, cw->mini.window, None);
	
	cw->focused = 0;
}
static void
set_damage_object_internal (CoglContext *ctx,
                            CoglTexturePixmapX11 *tex_pixmap,
                            Damage damage,
                            CoglTexturePixmapX11ReportLevel report_level)
{
  Display *display = cogl_xlib_renderer_get_display (ctx->display->renderer);

  if (tex_pixmap->damage)
    {
      cogl_xlib_renderer_remove_filter (ctx->display->renderer,
                                        _cogl_texture_pixmap_x11_filter,
                                        tex_pixmap);

      if (tex_pixmap->damage_owned)
        {
          XDamageDestroy (display, tex_pixmap->damage);
          tex_pixmap->damage_owned = FALSE;
        }
    }

  tex_pixmap->damage = damage;
  tex_pixmap->damage_report_level = report_level;

  if (damage)
    cogl_xlib_renderer_add_filter (ctx->display->renderer,
                                   _cogl_texture_pixmap_x11_filter,
                                   tex_pixmap);
}
Example #3
0
void remove_icon(TrayWindow *traywin)
{
	if (systray_profile)
		fprintf(stderr,
		        "[%f] %s:%d win = %lu (%s)\n",
		        profiling_get_time(),
		        __FUNCTION__,
		        __LINE__,
		        traywin->win,
		        traywin->name);
	Panel *panel = systray.area.panel;

	// remove from our list
	systray.list_icons = g_slist_remove(systray.list_icons, traywin);
	fprintf(stderr, YELLOW "remove_icon: %lu (%s)" RESET "\n", traywin->win, traywin->name);

	XSelectInput(server.display, traywin->win, NoEventMask);
	if (traywin->damage)
		XDamageDestroy(server.display, traywin->damage);

	// reparent to root
	XSync(server.display, False);
	error = FALSE;
	XErrorHandler old = XSetErrorHandler(window_error_handler);
	XUnmapWindow(server.display, traywin->win);
	XReparentWindow(server.display, traywin->win, server.root_win, 0, 0);
	XDestroyWindow(server.display, traywin->parent);
	XSync(server.display, False);
	XSetErrorHandler(old);
	stop_timeout(traywin->render_timeout);
	stop_timeout(traywin->resize_timeout);
	free(traywin->name);
	if (traywin->image) {
		imlib_context_set_image(traywin->image);
		imlib_free_image_and_decache();
	}
	g_free(traywin);

	// check empty systray
	int count = 0;
	GSList *l;
	for (l = systray.list_icons; l; l = l->next) {
		count++;
	}
	if (count == 0)
		hide(&systray.area);

	// Resize and redraw the systray
	if (systray_profile)
		fprintf(stderr,
				BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
				profiling_get_time(),
				__FUNCTION__,
				__LINE__);
	systray.area.resize_needed = TRUE;
	panel->area.resize_needed = TRUE;
	schedule_redraw(&systray.area);
	refresh_systray = TRUE;
}
Example #4
0
EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
{
#ifdef ECORE_XDAMAGE
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   XDamageDestroy(_ecore_x_disp, damage);
#endif /* ifdef ECORE_XDAMAGE */
}
Example #5
0
/*
 * Normal exiting
 */
void clean_up_exit (int ret) {
	static int depth = 0;
	exit_flag = 1;

	if (depth++ > 2) {
		exit(ret);
	}

	if (icon_mode) {
		clean_icon_mode();
	}

	/* remove the shm areas: */
	clean_shm(0);

	stop_stunnel();
	if (use_openssl) {
		ssl_helper_pid(0, 0);	/* killall */
	}

	if (! dpy) exit(ret);	/* raw_rb hack */

	/* X keyboard cleanups */
	delete_added_keycodes(0);

	if (clear_mods == 1) {
		clear_modifiers(0);
	} else if (clear_mods == 2) {
		clear_keys();
	}

	if (no_autorepeat) {
		autorepeat(1, 0);
	}
	if (use_solid_bg) {
		solid_bg(1);
	}
	X_LOCK;
	XTestDiscard_wr(dpy);
#if LIBVNCSERVER_HAVE_LIBXDAMAGE
	if (xdamage) {
		XDamageDestroy(dpy, xdamage);
	}
#endif
#if LIBVNCSERVER_HAVE_LIBXTRAP
	if (trap_ctx) {
		XEFreeTC(trap_ctx);
	}
#endif
	/* XXX rdpy_ctrl, etc. cannot close w/o blocking */
	XCloseDisplay_wr(dpy);
	X_UNLOCK;

	fflush(stderr);
	exit(ret);
}
Example #6
0
static void
ccm_damage_callback_unref (CCMDamageCallback* self)
{
    if (g_atomic_int_dec_and_test (&self->ref_count))
    {
        XDamageDestroy (CCM_DISPLAY_XDISPLAY (CCMDefaultDisplay), self->damage);
        g_signal_emit (CCMDefaultDisplay, signals[DAMAGE_DESTROY], 0, self->damage, self->drawable);
        g_slice_free (CCMDamageCallback, self);
    }
}
Example #7
0
void
clientwin_map(ClientWin *cw)
{
	if(cw->damage)
		XDamageDestroy(cw->mainwin->dpy, cw->damage);
	
	cw->damage = XDamageCreate(cw->mainwin->dpy, cw->client.window, XDamageReportDeltaRectangles);
	XRenderSetPictureTransform(cw->mainwin->dpy, cw->origin, &cw->mainwin->transform);
	
	clientwin_render(cw);
	
	XMapWindow(cw->mainwin->dpy, cw->mini.window);
}
Example #8
0
void xf_xdamage_init(xfInfo* xfi)
{
	int damage_event;
	int damage_error;
	int major, minor;
	XGCValues values;

	if (XDamageQueryExtension(xfi->display, &damage_event, &damage_error) == 0)
	{
		fprintf(stderr, "XDamageQueryExtension failed\n");
		return;
	}

	XDamageQueryVersion(xfi->display, &major, &minor);

	if (XDamageQueryVersion(xfi->display, &major, &minor) == 0)
	{
		fprintf(stderr, "XDamageQueryVersion failed\n");
		return;
	}
	else if (major < 1)
	{
		fprintf(stderr, "XDamageQueryVersion failed: major:%d minor:%d\n", major, minor);
		return;
	}

	xfi->xdamage_notify_event = damage_event + XDamageNotify;
	xfi->xdamage = XDamageCreate(xfi->display, xfi->root_window, XDamageReportDeltaRectangles);

	if (xfi->xdamage == None)
	{
		fprintf(stderr, "XDamageCreate failed\n");
		return;
	}

#ifdef WITH_XFIXES
	xfi->xdamage_region = XFixesCreateRegion(xfi->display, NULL, 0);

	if (xfi->xdamage_region == None)
	{
		fprintf(stderr, "XFixesCreateRegion failed\n");
		XDamageDestroy(xfi->display, xfi->xdamage);
		xfi->xdamage = None;
		return;
	}
#endif

	values.subwindow_mode = IncludeInferiors;
	xfi->xdamage_gc = XCreateGC(xfi->display, xfi->root_window, GCSubwindowMode, &values);
	XSetFunction(xfi->display, xfi->xdamage_gc, GXcopy);
}
Example #9
0
RedirectedXCompositeWindow::~RedirectedXCompositeWindow()
{
    ASSERT(m_display);
    ASSERT(m_damage);
    ASSERT(m_window);
    ASSERT(m_parentWindow);

    xDamageNotifier().remove(m_window);

    XDamageDestroy(m_display, m_damage);
    XDestroyWindow(m_display, m_window);
    XDestroyWindow(m_display, m_parentWindow);
    cleanupPixmapAndPixmapSurface();
}
void FdoSelectionManager::removeDamageWatch(QWidget *container)
{
#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE)
    for (QMap<WId, DamageWatch*>::Iterator it = damageWatches.begin(); it != damageWatches.end(); ++it)
    {
        DamageWatch *damage = *(it);
        if (damage->container == container) {
             XDamageDestroy(QX11Info::display(), damage->damage);
             damageWatches.erase(it);
             delete damage;
             break;
        } 
    }
#endif
}
static void
free_damage (MetaSurfaceActorX11 *self)
{
  MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
  MetaDisplay *display = priv->display;
  Display *xdisplay = meta_display_get_xdisplay (display);

  if (priv->damage == None)
    return;

  meta_error_trap_push (display);
  XDamageDestroy (xdisplay, priv->damage);
  priv->damage = None;
  meta_error_trap_pop (display);
}
RedirectedXCompositeWindow::~RedirectedXCompositeWindow()
{
    ASSERT(m_damage);
    ASSERT(m_window);
    ASSERT(m_parentWindow);

    getWindowHashMap().remove(m_window);
    if (getWindowHashMap().isEmpty())
        gdk_window_remove_filter(0, reinterpret_cast<GdkFilterFunc>(filterXDamageEvent), 0);

    Display* display = GLContext::sharedX11Display();
    XDamageDestroy(display, m_damage);
    XDestroyWindow(display, m_window);
    XDestroyWindow(display, m_parentWindow);
    cleanupPixmapAndPixmapSurface();
}
Example #13
0
void
clientwin_destroy(ClientWin *cw, Bool parentDestroyed)
{
	if(! parentDestroyed)
	{
		if(cw->origin != None)
			XRenderFreePicture(cw->mainwin->dpy, cw->origin);
		if(cw->damage != None)
			XDamageDestroy(cw->mainwin->dpy, cw->damage);
	}
	if(cw->destination != None)
		XRenderFreePicture(cw->mainwin->dpy, cw->destination);
	if(cw->pixmap != None)
		XFreePixmap(cw->mainwin->dpy, cw->pixmap);
	
	XDestroyWindow(cw->mainwin->dpy, cw->mini.window);
	
	free(cw);
}
Example #14
0
TrayIcon::~TrayIcon()
{
    Display* dsp = QX11Info::display();
    XSelectInput(dsp, mIconId, NoEventMask);

    if (mDamage)
        XDamageDestroy(dsp, mDamage);

    // reparent to root
    xError = false;
    XErrorHandler old = XSetErrorHandler(windowErrorHandler);

    XUnmapWindow(dsp, mIconId);
    XReparentWindow(dsp, mIconId, QX11Info::appRootWindow(), 0, 0);

    XDestroyWindow(dsp, mWindowId);
    XSync(dsp, False);
    XSetErrorHandler(old);
}
Example #15
0
Thumbnail::~Thumbnail()
{
    if (_xftDraw)
        XftDrawDestroy(_xftDraw);

    if (_gc)
        XFreeGC(_dpy, _gc);

    delete _image;

    if (! _clientDestroyed)
    {
        XSelectInput(_dpy, _clientWindow, 0);
        XDamageDestroy(_dpy, _damage);
        XRenderFreePicture(_dpy, _clientPict);
    }

    free(_title);
    free(_clientClass);
}
static void
free_damage_resources (ClutterX11TexturePixmap *texture)
{
  ClutterX11TexturePixmapPrivate *priv;
  Display                        *dpy;

  priv = texture->priv;
  dpy = clutter_x11_get_default_display();

  if (priv->damage)
    {
      clutter_x11_trap_x_errors ();
      XDamageDestroy (dpy, priv->damage);
      XSync (dpy, FALSE);
      clutter_x11_untrap_x_errors ();
      priv->damage = None;
      priv->damage_drawable = None;
    }

  clutter_x11_remove_filter (on_x_event_filter, (gpointer)texture);
}
Example #17
0
static void
set_damage_object_internal (CoglTexturePixmapX11 *tex_pixmap,
                            Damage damage,
                            CoglTexturePixmapX11ReportLevel report_level)
{
  if (tex_pixmap->damage)
    {
      _cogl_xlib_remove_filter (_cogl_texture_pixmap_x11_filter, tex_pixmap);

      if (tex_pixmap->damage_owned)
        {
          XDamageDestroy (_cogl_xlib_get_display (), tex_pixmap->damage);
          tex_pixmap->damage_owned = FALSE;
        }
    }

  tex_pixmap->damage = damage;
  tex_pixmap->damage_report_level = report_level;

  if (damage)
    _cogl_xlib_add_filter (_cogl_texture_pixmap_x11_filter, tex_pixmap);
}
Example #18
0
CompositeWindow::~CompositeWindow ()
{

    if (priv->damage)
	XDamageDestroy (screen->dpy (), priv->damage);

     if (!priv->redirected)
    {
	priv->cScreen->overlayWindowCount ()--;

	if (priv->cScreen->overlayWindowCount () < 1)
	    priv->cScreen->showOutputWindow ();
    }

    release ();

    addDamage ();

    if (lastDamagedWindow == priv->window)
	lastDamagedWindow = NULL;

    delete priv;
}
Example #19
0
/*
 * Normal exiting
 */
void clean_up_exit(int ret) {
	static int depth = 0;
	exit_flag = 1;

	if (depth++ > 2) {
		exit(ret);
	}

	if (icon_mode) {
		clean_icon_mode();
	}

	/* remove the shm areas: */
	clean_shm(0);

	stop_stunnel();
	if (use_openssl) {
		ssl_helper_pid(0, 0);	/* killall */
	}

	if (ssh_pid > 0) {
		kill(ssh_pid, SIGTERM);
		ssh_pid = 0;
	}

#ifdef MACOSX
	if (client_connect_file) {
		if (strstr(client_connect_file, "/tmp/x11vnc-macosx-remote")
		    == client_connect_file) {
			unlink(client_connect_file);
		}
	}
	if (macosx_console) {
		macosxCG_fini();
	}
#endif

	if (pipeinput_fh != NULL) {
		pclose(pipeinput_fh);
		pipeinput_fh = NULL;
	}


	shutdown_uinput();

	if (unix_sock) {
		if (unix_sock_fd >= 0) {
			rfbLog("deleting unix sock: %s\n", unix_sock);
			close(unix_sock_fd);
			unix_sock_fd = -1;
			unlink(unix_sock);
		}
	}

	if (! dpy) {	/* raw_rb hack */
		if (rm_flagfile) {
			unlink(rm_flagfile);
			rm_flagfile = NULL;
		}
		exit(ret);
	}

	/* X keyboard cleanups */
	delete_added_keycodes(0);

	if (clear_mods == 1) {
		clear_modifiers(0);
	} else if (clear_mods == 2) {
		clear_keys();
	} else if (clear_mods == 3) {
		clear_keys();
		clear_locks();
	}

	if (no_autorepeat) {
		autorepeat(1, 0);
	}
	if (use_solid_bg) {
		solid_bg(1);
	}
	if (ncache || ncache0) {
		kde_no_animate(1);
	}
	X_LOCK;
	XTestDiscard_wr(dpy);
#if LIBVNCSERVER_HAVE_LIBXDAMAGE
	if (xdamage) {
		XDamageDestroy(dpy, xdamage);
	}
#endif
#if LIBVNCSERVER_HAVE_LIBXTRAP
	if (trap_ctx) {
		XEFreeTC(trap_ctx);
	}
#endif
	/* XXX rdpy_ctrl, etc. cannot close w/o blocking */
	XCloseDisplay_wr(dpy);
	X_UNLOCK;

	fflush(stderr);

	if (rm_flagfile) {
		unlink(rm_flagfile);
		rm_flagfile = NULL;
	}

	if (avahi) {
		avahi_cleanup();
		fflush(stderr);
	}

	exit(ret);
}
Example #20
0
template<> void XUniqueResource<XResource::Damage>::deleteXResource(unsigned long resource)
{
    if (resource)
        XDamageDestroy(sharedDisplay(), resource);
}