Como instalar a extensão Xev X11 para compilar programas baseados em Xevie

2

Existe um comando para instalar o Xevie (para programação X11) do repositório?

(para que Xevie.h esteja disponível para programação)

Eu preciso compilar este exemplo no Qt Creator:

/* xeviedemo.c */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/X.h>
#include <X11/extensions/Xevie.h>
#include <X11/Xutil.h>


static void
print_key_event (XEvent *ev)
{
    XKeyEvent *key_ev;
    char buffer[20];
    int bufsize = 19;
    KeySym key;
    XComposeStatus compose;
    int char_count;

    key_ev = (XKeyEvent *)ev;

    printf ("        State: %x KeyCode: %x\n", key_ev->state & ShiftMask, key_ev->keycode);
    char_count = XLookupString(key_ev, buffer, bufsize, &key, &compose);
    buffer[char_count] = '
/* xeviedemo.c */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/X.h>
#include <X11/extensions/Xevie.h>
#include <X11/Xutil.h>


static void
print_key_event (XEvent *ev)
{
    XKeyEvent *key_ev;
    char buffer[20];
    int bufsize = 19;
    KeySym key;
    XComposeStatus compose;
    int char_count;

    key_ev = (XKeyEvent *)ev;

    printf ("        State: %x KeyCode: %x\n", key_ev->state & ShiftMask, key_ev->keycode);
    char_count = XLookupString(key_ev, buffer, bufsize, &key, &compose);
    buffer[char_count] = '%pre%';
    printf ("        Char Count: %d KeySym: %x char: |%c|\n", char_count, key, buffer[0]);
}

int
main(int argc, char **argv)
{
    Display *dpy;
    int major, minor;
    XEvent  event;
    XClientMessageEvent *xcme;
    int count = 0;
    long delay = 0;
    int ret;

    if (argc > 2)
    {
        printf ("Usage: xeviedemo delay (in milliseconds)\n");
        exit(1);
    }
    else if (argc == 2)
    {
        delay = strtol(argv[1], 0, 0);
    }
    printf("Delay is %d milliseconds\n", delay);
    delay *= 1000;

    dpy = XOpenDisplay(NULL);
    XevieQueryVersion(dpy, &major, &minor);
    printf("major = %d, minor = %d\n", major, minor);
    if(XevieStart(dpy))
        printf("XevieStart(dpy) finished \n");
    else
    {
        printf("XevieStart(dpy) failed, only one client is allowed to do event interception\n");
        exit(1);
    }

    XevieSelectInput(dpy, KeyPressMask | KeyReleaseMask |
                     ButtonPressMask | ButtonReleaseMask | PointerMotionMask);

    while(1)
    {
        XNextEvent(dpy, &event);
        xcme = (XClientMessageEvent *)&event;
        /* for readOnly users, send events back to Xserver immediately */
        printf("(%4d)", count++);
        switch(event.type)
        {
        case KeyPress:
            usleep(delay);
            printf(" KeyPress\n");
            print_key_event (&event);
            break;
        case KeyRelease:
            printf(" KeyRelease\n");
            break;
        case ButtonPress:
            usleep(delay);
            printf(" ButtonPress\n");
            break;
        case ButtonRelease:
            printf(" ButtonRelease\n");
            break;
        case MotionNotify:
            printf(" MotionNotify\n");
            break;
        case ClientMessage:
            printf("ClientMessage: <%s>\n", &xcme->data.b[1]);
            break;
        default:
            printf(" unknown event %x\n", event.type);
            break;
        }
        XevieSendEvent(dpy, &event, XEVIE_UNMODIFIED);
        if(count > 10000)
        {
            break;
        }
    }
    XevieEnd(dpy);
    printf("XevieEnd(dpy) finished \n");
    exit(0);
}
'; printf (" Char Count: %d KeySym: %x char: |%c|\n", char_count, key, buffer[0]); } int main(int argc, char **argv) { Display *dpy; int major, minor; XEvent event; XClientMessageEvent *xcme; int count = 0; long delay = 0; int ret; if (argc > 2) { printf ("Usage: xeviedemo delay (in milliseconds)\n"); exit(1); } else if (argc == 2) { delay = strtol(argv[1], 0, 0); } printf("Delay is %d milliseconds\n", delay); delay *= 1000; dpy = XOpenDisplay(NULL); XevieQueryVersion(dpy, &major, &minor); printf("major = %d, minor = %d\n", major, minor); if(XevieStart(dpy)) printf("XevieStart(dpy) finished \n"); else { printf("XevieStart(dpy) failed, only one client is allowed to do event interception\n"); exit(1); } XevieSelectInput(dpy, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); while(1) { XNextEvent(dpy, &event); xcme = (XClientMessageEvent *)&event; /* for readOnly users, send events back to Xserver immediately */ printf("(%4d)", count++); switch(event.type) { case KeyPress: usleep(delay); printf(" KeyPress\n"); print_key_event (&event); break; case KeyRelease: printf(" KeyRelease\n"); break; case ButtonPress: usleep(delay); printf(" ButtonPress\n"); break; case ButtonRelease: printf(" ButtonRelease\n"); break; case MotionNotify: printf(" MotionNotify\n"); break; case ClientMessage: printf("ClientMessage: <%s>\n", &xcme->data.b[1]); break; default: printf(" unknown event %x\n", event.type); break; } XevieSendEvent(dpy, &event, XEVIE_UNMODIFIED); if(count > 10000) { break; } } XevieEnd(dpy); printf("XevieEnd(dpy) finished \n"); exit(0); }
    
por user126106 11.05.2014 / 04:20

2 respostas

2

Eu não acho que nenhum pacote forneça Xevie.h . Existe uma biblioteca diferente chamada xevie.h , que é fornecida por libxcb-xevie0-dev , mas não é isso que você precisa.

No entanto, eu encontrei esta página que tem o que parece com os pacotes de origem. Tentei fazer o download do libXevie-1.0.3.tbz e posso confirmar que ele contém um arquivo chamado Xevie.h que inclui as funções do seu comentário. Na verdade, o arquivo é tão pequeno que estou reproduzindo tudo aqui:

/************************************************************

Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

************************************************************/

#ifndef _XEVIE_H_
#define _XEVIE_H_

#include <X11/Xfuncproto.h>

#define XEVIE_UNMODIFIED    0
#define XEVIE_MODIFIED   1

#ifndef _XEVIE_SERVER_

_XFUNCPROTOBEGIN

Bool XevieQueryVersion(
    Display*            /* dpy */,
    int*            /* major_version */,
    int*            /* minor_version */
);

extern Status XevieStart(
    Display*            /* dpy */
);

Status XevieEnd(
    Display*            /* dpy */
);

Status XevieSendEvent(
    Display*                    /* dpy */,
    XEvent*         /* event */,
    int             /* data type */
);

Status XevieSelectInput(
    Display*                    /* dpy */,
    long
);


_XFUNCPROTOEND

#endif /* _XEVIE_SERVER_ */

#endif /* _XEVIE_H_ */

Ao procurar um arquivo específico, você pode procurá-lo no link ou usar apt-file :

$ apt-file search xevie.h
libxcb-xevie0-dev: /usr/include/xcb/xevie.h

Como você pode ver, usar apt-file search filename retorna o pacote (se houver) que fornece o arquivo. Se apt-file não estiver instalado, você precisará instalá-lo e gerar sua lista de pacotes antes de executá-lo:

sudo apt-get install apt-file
sudo apt-file update
    
por terdon 11.05.2014 / 04:39
1

O suporte ao Xevie foi removido do Xorg no X11R7.5 em 2009 desde que ele foi quebrado por um tempo e ninguém precisou ou estava interessado em corrigi-lo . Mesmo se você encontrar a biblioteca e os arquivos de cabeçalho para construir clientes, eles não funcionarão com qualquer servidor Xorg recente.

    
por alanc 12.05.2014 / 06:37