Exemplo n.º 1
0
void Gesture::stroke_timeout()
{
    kDebug() << "GESTURE: timeout";
    XAllowEvents( QX11Info::display(), AsyncPointer, CurrentTime );
    XUngrabPointer( QX11Info::display(), CurrentTime );
    mouse_replay( false );

    // for xorg-server 1.7 to 1.9 RC4: disable drag'n'drop support to evade bug #173606
    if( VendorRelease( QX11Info::display() ) < 10899905 &&  VendorRelease( QX11Info::display() ) >= 10700000 )
        mouse_replay( true );

    recording = false;
}
Exemplo n.º 2
0
/**
 * Do deferred logging after initialisation
 */
void doXKeyboardLogging(Display *dpy)
{
    if (((1 == gfByTypeOK) || (1 == gfByXkbOK)) && (gfByLayoutOK != 1))
        dumpLayout(dpy);
    if (((1 == gfByLayoutOK) || (1 == gfByXkbOK)) && (gfByTypeOK != 1))
        dumpType(dpy);
    if ((gfByLayoutOK != 1) && (gfByTypeOK != 1) && (gfByXkbOK != 1))
    {
        LogRel(("Failed to recognize the keyboard mapping or to guess it based on\n"
                "the keyboard layout.  It is very likely that some keys will not\n"
                "work correctly in the guest.  If this is the case, please submit\n"
                "a bug report, giving us information about your keyboard type,\n"
                "its layout and other relevant information such as whether you\n"
                "are using a remote X server or something similar. \n"));
        unsigned *keyc2scan = X11DRV_getKeyc2scan();

        LogRel(("The keycode-to-scancode table is: %d=%d",0,keyc2scan[0]));
        for (int i = 1; i < 256; i++)
            LogRel((",%d=%d",i,keyc2scan[i]));
        LogRel(("\n"));
    }
    LogRel(("X Server details: vendor: %s, release: %d, protocol version: %d.%d, display string: %s\n",
            ServerVendor(dpy), VendorRelease(dpy), ProtocolVersion(dpy),
            ProtocolRevision(dpy), DisplayString(dpy)));
    LogRel(("Using %s for keycode to scan code conversion\n",
              gfByXkbOK ? "XKB"
            : gfByTypeOK ? "known keycode mapping"
            : "host keyboard layout detection"));
}
static int isSunXServer() {
#ifdef __solaris__
  return (strcmp("Sun Microsystems, Inc.", ServerVendor(awt_display)) == 0 &&
          VendorRelease(awt_display) >= 6410);
#else
  return 0;
#endif /* __solaris__ */
}
Exemplo n.º 4
0
static void gtkSetDrvGlobalAttrib(void)
{
  GdkDisplay* display = gdk_display_get_default();
  Display* xdisplay = GDK_DISPLAY_XDISPLAY(display);
  IupSetGlobal("XDISPLAY", (char*)xdisplay);
  IupSetGlobal("XSCREEN", (char*)XDefaultScreen(xdisplay));
  IupSetGlobal("XSERVERVENDOR", ServerVendor(xdisplay));
  IupSetfAttribute(NULL, "XVENDORRELEASE", "%d", VendorRelease(xdisplay));
}
Exemplo n.º 5
0
int NvCtrlGetVendorRelease(NvCtrlAttributeHandle *handle)
{
    NvCtrlAttributePrivateHandle *h;

    if (!handle) return -1;

    h = (NvCtrlAttributePrivateHandle *) handle;

    if (!h->dpy) return -1;
    return VendorRelease(h->dpy);

} /* NvCtrlGetVendorRelease() */
Exemplo n.º 6
0
void
TkGetServerInfo(
    Tcl_Interp *interp,		/* The server information is returned in this
				 * interpreter's result. */
    Tk_Window tkwin)		/* Token for window; this selects a particular
				 * display and server. */
{
    Tcl_SetObjResult(interp, Tcl_ObjPrintf("X%dR%d %s %d",
	    ProtocolVersion(Tk_Display(tkwin)),
	    ProtocolRevision(Tk_Display(tkwin)),
	    ServerVendor(Tk_Display(tkwin)),
	    VendorRelease(Tk_Display(tkwin))));
}
Exemplo n.º 7
0
void
TkGetServerInfo(
    Tcl_Interp *interp,		/* The server information is returned in this
				 * interpreter's result. */
    Tk_Window tkwin)		/* Token for window; this selects a particular
				 * display and server. */
{
    char buffer[8 + TCL_INTEGER_SPACE * 2];
    char buffer2[TCL_INTEGER_SPACE];

    sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
	    ProtocolRevision(Tk_Display(tkwin)));
    sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
    Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
	    buffer2, (char *) NULL);
}
static void
activation_error (void)
{
	char const *vendor = ServerVendor (GDK_DISPLAY ());
	int release = VendorRelease (GDK_DISPLAY ());
	GtkWidget *dialog;
	gboolean badXFree430Release;

	badXFree430Release = (vendor != NULL)
	    && (0 == strcmp (vendor, "The XFree86 Project, Inc"))
	    && (release / 100000 == 403);

	/* VNC viewers will not work, do not barrage them with warnings */
	if (NULL != vendor && NULL != strstr (vendor, "VNC"))
		return;

	dialog = gtk_message_dialog_new_with_markup (NULL,
						     0,
						     GTK_MESSAGE_ERROR,
						     GTK_BUTTONS_CLOSE,
						     _
						     ("Error activating XKB configuration.\n"
						      "It can happen under various circumstances:\n"
						      "- a bug in libxklavier library\n"
						      "- a bug in X server (xkbcomp, xmodmap utilities)\n"
						      "- X server with incompatible libxkbfile implementation\n\n"
						      "X server version data:\n%s\n%d\n%s\n"
						      "If you report this situation as a bug, please include:\n"
						      "- The result of <b>%s</b>\n"
						      "- The result of <b>%s</b>"),
						     vendor,
						     release,
						     badXFree430Release
						     ?
						     _
						     ("You are using XFree 4.3.0.\n"
						      "There are known problems with complex XKB configurations.\n"
						      "Try using a simpler configuration or taking a fresher version of XFree software.")
						     : "",
						     "xprop -root | grep XKB",
						     "gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd");
	g_signal_connect (dialog, "response",
			  G_CALLBACK (gtk_widget_destroy), NULL);
	gsd_delayed_show_dialog (dialog);
}
Exemplo n.º 9
0
static qint64 getXServerVersion()
{
    qint64 major, minor, patch;

    Display *dpy = display();
    if (dpy && strstr(ServerVendor(dpy), "X.Org")) {
        const int release  = VendorRelease(dpy);
        major = (release / 10000000);
        minor = (release /   100000) % 100;
        patch = (release /     1000) % 100;
    } else {
        major = 0;
        minor = 0;
        patch = 0;
    }

    return kVersionNumber(major, minor, patch);
}
Exemplo n.º 10
0
void
menu_about (GtkWidget * wid, gpointer sess)
{
	char buf[512];
	const gchar *author[] = { "Peter Zelezny <*****@*****.**>", 0 };

	snprintf (buf, sizeof (buf),
				 _("An IRC Client for UNIX.\n\n"
				 "This binary was compiled on "__DATE__"\n"
				 "Using GTK %d.%d.%d X %d\n"
				 "Running on %s"),
				 gtk_major_version, gtk_minor_version, gtk_micro_version,
#ifdef USE_XLIB
				VendorRelease (GDK_DISPLAY ()), get_cpu_str());
#else
				666, get_cpu_str());
#endif

	gtk_widget_show (gnome_about_new ("X-Chat", VERSION,
							"(C) 1998-2001 Peter Zelezny", author, buf, 0));
}
main()
{
	Display * display;
	int       screen;
	char *    display_name=NULL;
	Window    root;
	Visual*   visual;

	/* Connect to X display server.		*/
	display=XOpenDisplay(display_name);

	/* Get screen ID			*/
	screen=DefaultScreen(display);


	printf("\n\tInformation extracted from the X server\n");
	printf("\t---------------------------------------\n\n");

	printf(" X server by \'%s\'\n",        ServerVendor(display));

	printf(" X Server protocol %d\n",      ProtocolVersion(display));

	printf(" X server Release %d\n",       VendorRelease(display));

	printf(" Screen is %dmm high.\n",      DisplayHeightMM(display, screen));

	printf(" Screen is %dmm wide.\n",      DisplayWidthMM(display, screen));

	printf(" Screen is %d pixels high.\n", DisplayHeight(display, screen));

	printf(" Screen is %d pixels wide.\n", DisplayWidth(display, screen));

	visual = DefaultVisual(display,screen);
	printf(" %3d Colour map entries", visual->map_entries);
	printf(" (Number of colours on the screen at one time).\n");

	printf(" %3d Display planes (bits per screen pixel).\n", DisplayPlanes(display, screen));

	printf(" There is %d screen(s).\n", ScreenCount (display));
}
Exemplo n.º 12
0
bool Calibrator::has_xorgconfd_support(Display* dpy) {
    bool has_support = false;

    Display* display = dpy;
    if (dpy == NULL) // no connection to reuse
        display = XOpenDisplay(NULL);

    if (display == NULL) {
        fprintf(stderr, "Unable to connect to X server\n");
        exit(1);
    }

    if (strstr(ServerVendor(display), "X.Org") &&
        VendorRelease(display) >= 10800000) {
        has_support = true;
    }

    if (dpy == NULL) // no connection to reuse
        XCloseDisplay(display);

    return has_support;
}
Exemplo n.º 13
0
cairo_xlib_display_t *
_cairo_xlib_display_get (Display *dpy)
{
    cairo_xlib_display_t *display;
    cairo_xlib_display_t **prev;
    XExtCodes *codes;
    int major_unused, minor_unused;

    /* There is an apparent deadlock between this mutex and the
     * mutex for the display, but it's actually safe. For the
     * app to call XCloseDisplay() while any other thread is
     * inside this function would be an error in the logic
     * app, and the CloseDisplay hook is the only other place we
     * acquire this mutex.
     */
    CAIRO_MUTEX_LOCK (_cairo_xlib_display_mutex);

    for (prev = &_cairo_xlib_display_list; (display = *prev); prev = &(*prev)->next)
    {
	if (display->display == dpy) {
	    /*
	     * MRU the list
	     */
	    if (prev != &_cairo_xlib_display_list) {
		*prev = display->next;
		display->next = _cairo_xlib_display_list;
		_cairo_xlib_display_list = display;
	    }
	    break;
	}
    }

    if (display != NULL) {
	display = _cairo_xlib_display_reference (display);
	goto UNLOCK;
    }

    display = malloc (sizeof (cairo_xlib_display_t));
    if (display == NULL) {
	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
	goto UNLOCK;
    }

    /* Xlib calls out to the extension close_display hooks in LIFO
     * order. So we have to ensure that all extensions that we depend
     * on in our close_display hook are properly initialized before we
     * add our hook. For now, that means Render, so we call into its
     * QueryVersion function to ensure it gets initialized.
     */
    XRenderQueryVersion (dpy, &major_unused, &minor_unused);

    codes = XAddExtension (dpy);
    if (codes == NULL) {
	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
	free (display);
	display = NULL;
	goto UNLOCK;
    }

    XESetCloseDisplay (dpy, codes->extension, _cairo_xlib_close_display);

    _cairo_freelist_init (&display->wq_freelist, sizeof (cairo_xlib_job_t));
    _cairo_freelist_init (&display->hook_freelist, sizeof (cairo_xlib_hook_t));

    CAIRO_REFERENCE_COUNT_INIT (&display->ref_count, 2); /* add one for the CloseDisplay */
    CAIRO_MUTEX_INIT (display->mutex);
    display->display = dpy;
    display->screens = NULL;
    display->workqueue = NULL;
    display->close_display_hooks = NULL;
    display->closed = FALSE;

    display->buggy_repeat = FALSE;
    if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
	/* When modularized, the X.Org server VendorRelease was
	 * bogusly reset to a very small number, without any change in
	 * the ServerVendor string. We avoid considering the new
	 * servers with the small number as buggy by restricting the
	 * test to known bad releases. But there could be a problem
	 * again in the future if X.Org server versions ever climb
	 * back up to 6.7 or 6.8. */
	if (VendorRelease (dpy) >= 60700000 && VendorRelease (dpy) <= 60802000)
	    display->buggy_repeat = TRUE;

	/* But even the new modular server has bugs, (bad enough to
	 * crash the X server), that it so happens we can avoid with
	 * the exact same buggy_repeat workaround. We've verified that
	 * this bug exists as least as late as version 1.3.0.0, (which
	 * is in Fedora 8), and is gone again in version 1.4.99.901
	 * (from a Fedora 9 Beta). Versions between those are still
	 * unknown, but until we learn more, we'll assume that any 1.3
	 * version is buggy.  */
	if (VendorRelease (dpy) < 10400000)
	    display->buggy_repeat = TRUE;
    } else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
	if (VendorRelease (dpy) <= 40500000)
	    display->buggy_repeat = TRUE;
    }

    display->next = _cairo_xlib_display_list;
    _cairo_xlib_display_list = display;

UNLOCK:
    CAIRO_MUTEX_UNLOCK (_cairo_xlib_display_mutex);
    return display;
}
Exemplo n.º 14
0
static ALLEGRO_SYSTEM *xglx_initialize(int flags)
{
   Display *x11display;
   Display *gfxdisplay;
   ALLEGRO_SYSTEM_XGLX *s;

   (void)flags;

#ifdef DEBUG_X11
   _Xdebug = 1;
#endif

   XInitThreads();

   /* Get an X11 display handle. */
   x11display = XOpenDisplay(0);
   if (x11display) {
      /* Never ask. */
      gfxdisplay = XOpenDisplay(0);
      if (!gfxdisplay) {
         ALLEGRO_ERROR("XOpenDisplay failed second time.\n");
         XCloseDisplay(x11display);
         return NULL;
      }
   }
   else {
      ALLEGRO_INFO("XOpenDisplay failed; assuming headless mode.\n");
      gfxdisplay = NULL;
   }
   
   _al_unix_init_time();

   s = al_calloc(1, sizeof *s);

   _al_mutex_init_recursive(&s->lock);
   _al_cond_init(&s->resized);
   s->inhibit_screensaver = false;

   _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY_XGLX *));

   s->system.vt = xglx_vt;

   s->gfxdisplay = gfxdisplay;
   s->x11display = x11display;

   if (s->x11display) {
      ALLEGRO_INFO("XGLX driver connected to X11 (%s %d).\n",
         ServerVendor(s->x11display), VendorRelease(s->x11display));
      ALLEGRO_INFO("X11 protocol version %d.%d.\n",
         ProtocolVersion(s->x11display), ProtocolRevision(s->x11display));

      /* We need to put *some* atom into the ClientMessage we send for
       * faking mouse movements with al_set_mouse_xy - so let's ask X11
       * for one here.
       */
      s->AllegroAtom = XInternAtom(x11display, "AllegroAtom", False);

      /* Message type for XEmbed protocol. */
      s->XEmbedAtom = XInternAtom(x11display, "_XEMBED", False);

      _al_thread_create(&s->xevents_thread, _al_xwin_background_thread, s);
      s->have_xevents_thread = true;
      ALLEGRO_INFO("events thread spawned.\n");
   }

   return &s->system;
}
Exemplo n.º 15
0
int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); }
Exemplo n.º 16
0
static const char *getBuildInfo(void)
{
    static const char *bldFormat =
        "%s\n"
        "     Built on: %s, %s, %s\n"
        "     Built at: %s, %s\n"
        "   With Motif: %s%d.%d.%d [%s]\n"
        "Running Motif: %d.%d [%s]\n"
        "       Server: %s %d\n"
        "       Visual: %s\n"
        "       Locale: %s\n"
       ;

    static const char *visualClass[] = {"StaticGray",  "GrayScale",
                                        "StaticColor", "PseudoColor",
                                        "TrueColor",   "DirectColor"};

    static const char *const stabilities[] = {"", "(Untested) ", "(Known Bad) "};

    if (bldInfoString == NULL)
    {
        const char *locale;
        char visualStr[500] = "<unknown>";
        const enum MotifStability stab = GetMotifStability();

        if (TheDisplay) {
            Visual     *visual;
            int         depth;
            Colormap    map;
            Boolean usingDefaultVisual = FindBestVisual(TheDisplay, APP_NAME,
                                                        APP_CLASS, &visual,
                                                        &depth, &map);
            sprintf(visualStr,"%d-bit %s (ID %#lx%s)",
                    depth,
                    visualClass[visual->class],
                    visual->visualid,
                    usingDefaultVisual ? ", Default" : "");
        }

        bldInfoString = XtMalloc(strlen(bldFormat) + strlen(warning) + 1024);
        locale = setlocale(LC_MESSAGES, "");

        sprintf(bldInfoString, bldFormat,
             NEditVersion,
             COMPILE_OS, COMPILE_MACHINE, COMPILE_COMPILER,
             linkdate, linktime,
             stabilities[stab], XmVERSION, XmREVISION, XmUPDATE_LEVEL,
             XmVERSION_STRING, 
             xmUseVersion/1000, xmUseVersion%1000,
             _XmVersionString,
             (NULL == TheDisplay ? "<unknown>" : ServerVendor(TheDisplay)),
             (NULL == TheDisplay ? 0 : VendorRelease(TheDisplay)),
             visualStr,
             locale ? locale : "None");

        if (stab == MotifKnownBad)
            strcat(bldInfoString, warning);

        atexit(freeBuildInfo);
    }
    
    return bldInfoString;
}
Exemplo n.º 17
0
void
check_AfterStep_dirtree ( char * ashome, Bool create_non_conf )
{
	char         *fullfilename;
	/* Create missing directories & put there defaults */
	if (CheckDir (ashome) != 0)
	{
		CheckOrCreate (ashome);

#if defined(DO_SEND_POSTCARD) /*&& defined(HAVE_POPEN) */
		/* send some info to sasha @ aftercode.net */
		{
			FILE *p;
			char *filename = make_file_name(ashome, ".postcard");
			/*p = popen ("mail -s \"AfterStep installation info\" [email protected]", "w");*/
			p = fopen( filename, "wt" );
			free(filename);
			if (p)
			{
				fprintf( p, "AfterStep_Version=\"%s\";\n", VERSION );
				fprintf( p, "CanonicalBuild=\"%s\";\n", CANONICAL_BUILD );
				fprintf( p, "CanonicalOS=\"%s\";\n", CANONICAL_BUILD_OS );
				fprintf( p, "CanonicalCPU=\"%s\";\n", CANONICAL_BUILD_CPU );
				fprintf( p, "CanonicalVendor=\"%s\";\n", CANONICAL_BUILD_VENDOR );
				if( dpy )
				{
					fprintf (p, "X_DefaultScreenNumber=%d;\n", DefaultScreen (dpy));
					fprintf (p, "X_NumberOfScreens=%d;\n", ScreenCount (dpy));
					fprintf (p, "X_Display=\"%s\";\n", DisplayString (dpy));
					fprintf (p, "X_ProtocolVersion=%d.%d;\n", ProtocolVersion (dpy), ProtocolRevision (dpy));
					fprintf (p, "X_Vendor=\"%s\";\n", ServerVendor (dpy));
					fprintf (p, "X_VendorRelease=%d;\n", VendorRelease (dpy));
					if (strstr(ServerVendor (dpy), "XFree86"))
					{
						int vendrel = VendorRelease(dpy);
						fprintf(p, "X_XFree86Version=");
						if (vendrel < 336)
						{
							fprintf(p, "%d.%d.%d", vendrel / 100, (vendrel / 10) % 10, vendrel       % 10);
						} else if (vendrel < 3900)
						{
							fprintf(p, "%d.%d", vendrel / 1000,  (vendrel /  100) % 10);
							if (((vendrel / 10) % 10) || (vendrel % 10))
							{
								fprintf(p, ".%d", (vendrel / 10) % 10);
								if (vendrel % 10)
									fprintf(p, ".%d", vendrel % 10);
							}
						} else if (vendrel < 40000000)
						{
							fprintf(p, "%d.%d", vendrel/1000,  (vendrel/10) % 10);
							if (vendrel % 10)
								fprintf(p, ".%d", vendrel % 10);
						} else
						{
							fprintf(p, "%d.%d.%d", vendrel/10000000,(vendrel/100000)%100, (vendrel/1000)%100);
							if (vendrel % 1000)
								fprintf(p, ".%d", vendrel % 1000);
						}
						fprintf(p, ";\n");
					}
					if( ASDefaultScrWidth > 0 )
					{
						fprintf( p, "AS_Screen=%ld;\n", ASDefaultScr->screen );
						fprintf( p, "AS_RootGeometry=%dx%d;\n", ASDefaultScrWidth, ASDefaultScrHeight );
					}
					if( ASDefaultVisual )
					{
						fprintf( p, "AS_Visual=0x%lx;\n", ASDefaultVisual->visual_info.visualid );
						fprintf( p, "AS_Colordepth=%d;\n", ASDefaultVisual->visual_info.depth );
						fprintf( p, "AS_RedMask=0x%lX;\n", ASDefaultVisual->visual_info.red_mask );
						fprintf( p, "AS_GreenMask=0x%lX;\n", ASDefaultVisual->visual_info.green_mask );
						fprintf( p, "AS_BlueMask=0x%lX;\n", ASDefaultVisual->visual_info.blue_mask );
						fprintf( p, "AS_ByteOrdering=%s;\n", (ImageByteOrder(ASDefaultVisual->dpy)==MSBFirst)?"MSBFirst":"LSBFirst" );
					}
				}
				fclose(p);
				/*pclose (p);*/
			/*p = popen ("mail -s \"AfterStep installation info\" [email protected]", "w");*/
			}
		}
#endif
	}
	fullfilename = make_file_name (ashome, AFTER_SAVE);
	CheckOrCreateFile (fullfilename);
	free( fullfilename );

#if 0
	fullfilename = make_file_name (ashome, THEME_FILE_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, LOOK_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, FEEL_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, THEME_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, COLORSCHEME_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, BACK_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );
#endif
	fullfilename = make_file_name (ashome, DESKTOP_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, ICON_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, FONT_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, TILE_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );

	fullfilename = make_file_name (ashome, WEBCACHE_DIR);
	CheckOrCreate(fullfilename);
	free( fullfilename );
	
	if( create_non_conf )
	{
		char *postcard_fname ;
		FILE *f ;
		fullfilename = make_file_name (ashome, AFTER_NONCF);
		/* legacy non-configurable dir: */
		CheckOrCreate(fullfilename);
		postcard_fname = make_file_name( fullfilename, "send_postcard.sh" );
		free( fullfilename );
		
		f = fopen( postcard_fname, "wt" );
		if( f ) 
		{
			fprintf( f, "#!/bin/sh\n\n" );
			fprintf( f, "if [ -r %s/.postcard ] \nthen echo -n \nelse rm %s \nexit\nfi\n", ashome, postcard_fname );
			fprintf( f, "x-terminal-emulator -e \"%s/tools/postcard.sh\"\n", AFTER_SHAREDIR );
			fprintf( f, "if [ -r %s/.postcard ] \nthen echo -n \nelse rm %s \nfi\n", ashome, postcard_fname );
			fclose( f );
		}
		chmod (postcard_fname, 0700);
		free(postcard_fname);
	}

	char *cachefilename = make_file_name(ashome, THUMBNAILS_DIR);
	CheckOrCreate(cachefilename);
	extern void set_asimage_thumbnails_cache_dir(const char*);
	set_asimage_thumbnails_cache_dir(cachefilename);
	free( cachefilename );
}
Exemplo n.º 18
0
static void
PreparePatternForUntiledDrawing(gfxPattern* aPattern,
                                const gfxMatrix& aDeviceToImage,
                                gfxASurface *currentTarget,
                                const gfxPattern::GraphicsFilter aDefaultFilter)
{
    // In theory we can handle this using cairo's EXTEND_PAD,
    // but implementation limitations mean we have to consult
    // the surface type.
    switch (currentTarget->GetType()) {

#ifdef MOZ_X11
        case gfxASurface::SurfaceTypeXlib:
        {
            // See bugs 324698, 422179, and 468496.  This is a workaround for
            // XRender's RepeatPad not being implemented correctly on old X
            // servers.
            //
            // In this situation, cairo avoids XRender and instead reads back
            // to perform EXTEND_PAD with pixman.  This is too slow so we
            // avoid EXTEND_PAD and set the filter to CAIRO_FILTER_FAST ---
            // otherwise, pixman's sampling will sample transparency for the
            // outside edges and we'll get blurry edges.
            //
            // But don't do this for simple downscales because it's horrible.
            // Downscaling means that device-space coordinates are
            // scaled *up* to find the image pixel coordinates.
            //
            // Cairo, and hence Gecko, can use RepeatPad on Xorg 1.7. We
            // enable EXTEND_PAD provided that we're running on a recent
            // enough X server.

            gfxXlibSurface *xlibSurface =
                static_cast<gfxXlibSurface *>(currentTarget);
            Display *dpy = xlibSurface->XDisplay();
            // This is the exact condition for cairo to avoid XRender for
            // EXTEND_PAD
            if (VendorRelease(dpy) >= 60700000 ||
                VendorRelease(dpy) < 10699000) {

                PRBool isDownscale =
                    aDeviceToImage.xx >= 1.0 && aDeviceToImage.yy >= 1.0 &&
                    aDeviceToImage.xy == 0.0 && aDeviceToImage.yx == 0.0;

                gfxPattern::GraphicsFilter filter =
                    isDownscale ? aDefaultFilter : gfxPattern::FILTER_FAST;
                aPattern->SetFilter(filter);

                // Use the default EXTEND_NONE
                break;
            }
            // else fall through to EXTEND_PAD and the default filter.
        }
#endif

        default:
            // turn on EXTEND_PAD.
            // This is what we really want for all surface types, if the
            // implementation was universally good.
            aPattern->SetExtend(gfxPattern::EXTEND_PAD);
            aPattern->SetFilter(aDefaultFilter);
            break;
    }
}
Exemplo n.º 19
0
void
menu_about (GtkWidget * wid, gpointer sess)
{
	GtkWidget *vbox, *label, *hbox;
	GtkStyle *about_style;
	GtkStyle *head_style;
	char buf[512];

	if (about)
	{
		gdk_window_show (about->window);
		return;
	}
	head_style = gtk_style_new ();
#ifndef WIN32
	gdk_font_unref (head_style->font);
	head_style->font = gdk_font_load ("-*-times-bold-i-*-*-*-240-*");
	if (!head_style->font)
		head_style->font = gdk_font_load ("fixed");
#endif
	head_style->fg[GTK_STATE_NORMAL] = colors[2];

	about_style = gtk_style_new ();
	gdk_font_unref (about_style->font);
	about_style->font = gdk_font_load ("fixed");

	about = gtk_window_new (GTK_WINDOW_DIALOG);
	gtk_window_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER);
	gtk_window_set_title (GTK_WINDOW (about), _("About X-Chat"));
	gtk_container_set_border_width (GTK_CONTAINER (about), 6);
	gtk_signal_connect (GTK_OBJECT (about), "destroy",
							  GTK_SIGNAL_FUNC (about_close), 0);
	gtk_widget_realize (about);

	vbox = gtk_vbox_new (0, 2);
	gtk_container_add (GTK_CONTAINER (about), vbox);
	/*gtk_widget_show (vbox);*/

	label = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY (label), FALSE);
	gtk_entry_set_text (GTK_ENTRY (label), "X-Chat " VERSION);
	gtk_widget_set_style (label, head_style);
	gtk_style_unref (head_style);
	gtk_container_add (GTK_CONTAINER (vbox), label);

	snprintf (buf, sizeof (buf),
				 _("(C) 1998-2001 Peter Zelezny <*****@*****.**>\n\n"
				 "An IRC Client for UNIX.\n\n"
				 "This binary was compiled on "__DATE__"\n"
				 "Using GTK %d.%d.%d X %d\n"
				 "Running on %s\n"),
				 gtk_major_version, gtk_minor_version, gtk_micro_version,
#ifdef USE_XLIB
				VendorRelease (GDK_DISPLAY ()), get_cpu_str());
#else
				666, get_cpu_str());
#endif

	label = gtk_label_new (buf);
	gtk_container_add (GTK_CONTAINER (vbox), label);
	gtk_widget_set_style (label, about_style);
	gtk_style_unref (about_style);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);

	wid = gtk_hseparator_new ();
	gtk_container_add (GTK_CONTAINER (vbox), wid);

	hbox = gtk_hbox_new (0, 2);
	gtk_container_add (GTK_CONTAINER (vbox), hbox);

	wid = gtk_button_new_with_label ("  Continue  ");
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
	GTK_WIDGET_SET_FLAGS (GTK_WIDGET (wid), GTK_CAN_DEFAULT);
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	gtk_widget_grab_default (wid);
	gtk_signal_connect (GTK_OBJECT (wid), "clicked",
							  GTK_SIGNAL_FUNC (gtkutil_destroy), about);

	gtk_widget_show_all (about);
}
Exemplo n.º 20
0
Arquivo: main.c Projeto: da4089/xguess
int main(int argc, char *argv[]) {
  Display  *display;
  char     *display_name;
  int      c = 0;
  int      operation = 0;
  int      long_index = 0;

  /*-- parse arguments and decide what to do */
  while (operation == 0) {
    c = getopt_long(argc, argv, "xyzmnrs:vkhV", long_options, &long_index);
    switch (c) {
    case 's':
      screen_number = strtol(optarg, NULL, 10);
      break;
    case 'x':
    case 'y':
    case 'z':
    case 'm':
    case 'n':
    case 'r':
    case 'v':
    case 'k':
      operation = c;
      break;
    case 'h':
      usage(argv[0]);
      exit(0);
    case 'V':
      printf("%s\n", VERSION);
      exit(0);
    case -1:
      operation = -1;
      break;
    case '?':
      usage(argv[0]);
      exit(1);
    }
  }

  /* check whether operation is set yet */
  if (operation < 1) {
    usage(argv[0]);
    exit(1);
  }

  /* check that we have a DISPLAY environment variable */
  if (!(display_name = getenv(DISPLAY))) {
    fprintf(stderr, "Cannot locate display - DISPLAY variable not set.\n\n");
    exit(1);
  }

  /* check that we have access to the display */
  if (!(display = XOpenDisplay(display_name))) {
    fprintf(stderr, "Cannot open display from DISPLAY variable.\n\n");
    exit(1);
  }

  /* check screen number */
  if (screen_number >= ScreenCount(display)) {
    fprintf(stderr, "cannot use screen %d, only %d screen(s) available.\n", screen_number, ScreenCount(display));
    usage(argv[0]);
    exit(1);
  }

  switch (operation) {
  case 'x':
    printf("%d\n", DisplayWidth(display, screen_number));
    break;
  case 'y':
    printf("%d\n", DisplayHeight(display, screen_number));
    break;
  case 'z':
    printf("%d\n", DefaultDepth(display, screen_number));
    break;
  case 'm':
    printf("%s\n", ServerVendor(display));
    break;
  case 'n':
    printf("%d\n", ScreenCount(display));
    break;
  case 'r':
    printf("%d\n", VendorRelease(display));
    break;
  case 'v':
    printf("%d.%d\n", ProtocolVersion(display), ProtocolRevision(display));
    break;
  case 'k':
    printf("%s\n", keyboard_guess(display));
    break;
  }

  exit(0);
}
Exemplo n.º 21
0
/* Create a new system object for the dummy X11 driver. */
static ALLEGRO_SYSTEM *xglx_initialize(int flags)
{
   Display *x11display;
   Display *gfxdisplay;
   ALLEGRO_SYSTEM_XGLX *s;

   (void)flags;

#ifdef DEBUG_X11
   _Xdebug = 1;
#endif

   XInitThreads();

   /* Get an X11 display handle. */
   x11display = XOpenDisplay(0);
   if (!x11display) {
      ALLEGRO_ERROR("XOpenDisplay failed.\n");
      return NULL;
   }

   /* Never ask. */
   gfxdisplay = XOpenDisplay(0);
   if (!gfxdisplay) {
      ALLEGRO_ERROR("XOpenDisplay failed.\n");
      XCloseDisplay(x11display);
      return NULL;
   }

   _al_unix_init_time();

   s = _AL_MALLOC(sizeof *s);
   memset(s, 0, sizeof *s);

   /* We need to put *some* atom into the ClientMessage we send for
    * faking mouse movements with al_set_mouse_xy - so lets ask X11
    * for one here.
    */
   s->AllegroAtom = XInternAtom(x11display, "AllegroAtom", False);

   _al_mutex_init_recursive(&s->lock);
   _al_cond_init(&s->resized);
   s->inhibit_screensaver = false;

   _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY_XGLX *));

   s->gfxdisplay = gfxdisplay;
   s->x11display = x11display;

   s->system.vt = xglx_vt;

   ALLEGRO_INFO("XGLX driver connected to X11 (%s %d).\n",
      ServerVendor(s->x11display), VendorRelease(s->x11display));
   ALLEGRO_INFO("X11 protocol version %d.%d.\n",
      ProtocolVersion(s->x11display), ProtocolRevision(s->x11display));

#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA
   _al_xsys_xinerama_init(s);
#endif

   _al_xglx_store_video_mode(s);
   
   _al_thread_create(&s->thread, xglx_background_thread, s);

   ALLEGRO_INFO("events thread spawned.\n");

   return &s->system;
}