Alien-Xmake

 view release on metacpan or  search on metacpan

builder/Alien/Xmake/Builder.pm  view on Meta::CPAN

                Carp::croak("Found directory '$dir', but no read permissions") unless -r $dir;
                return $dir;
            }

            sub _STRING (@parts) {
                ( defined $parts[0] and !ref $parts[0] and length( $parts[0] ) ) ? $parts[0] : undef;
            }
        };
        1;
        PERL
        $dest->spew_utf8($content);
        say "Generated $dest";
    }

    method _install_windows ($installdir) {
        my $temppath = path('_build_xmake');
        $temppath->mkpath;
        my $arch_env   = $ENV{PROCESSOR_ARCHITECTURE} // '';
        my $arch64_env = $ENV{PROCESSOR_ARCHITEW6432} // '';
        my $target     = $self->_desired_version;
        my $filename;

eg/nuklear/nk_win.c  view on Meta::CPAN

#else /* Unix / X11 */
static Display     *g_dpy;
static Window       g_win;
static int          g_screen;
static Atom         g_wm_delete;
static XFont       *g_font;

/* Convert a wide string (as passed from Perl's WString) to UTF-8 so the X11 window title is
   correct regardless of the platform's wchar_t width.
 */
static void wstr_to_utf8(const wchar_t *ws, char *out, size_t outsz) {
    size_t i = 0, o = 0;
    out[0] = '\0';
    if (!ws)
        return;
    for (i = 0; ws[i] != 0 && o + 4 < outsz; i++) {
        unsigned int cp = (unsigned int)ws[i];
        if (cp < 0x80) {
            out[o++] = (char)cp;
        }
        else if (cp < 0x800) {

eg/nuklear/nk_win.c  view on Meta::CPAN

            out[o++] = (char)(0x80 | ((cp >> 6) & 0x3F));
            out[o++] = (char)(0x80 | (cp & 0x3F));
        }
    }
    out[o] = '\0';
}

NK_WIN_API int nk_win_init(const wchar_t *title, int width, int height, const char *font_name, int font_size) {
    XSetWindowAttributes attrs;
    unsigned long mask;
    char title_utf8[256];
    const char *fc;

    g_dpy = XOpenDisplay(NULL);
    if (!g_dpy)
        return 0;
    g_screen = XDefaultScreen(g_dpy);

    mask = CWBackPixel | CWEventMask;
    attrs.background_pixel = BlackPixel(g_dpy, g_screen);
    attrs.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
        ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
        StructureNotifyMask;
    g_win = XCreateWindow(g_dpy, RootWindow(g_dpy, g_screen),
        0, 0, (unsigned)width, (unsigned)height, 0,
        CopyFromParent, InputOutput, CopyFromParent, mask, &attrs);
    if (!g_win)
        return 0;

    wstr_to_utf8(title, title_utf8, sizeof(title_utf8));
    XStoreName(g_dpy, g_win, title_utf8);
    g_wm_delete = XInternAtom(g_dpy, "WM_DELETE_WINDOW", False);
    XSetWMProtocols(g_dpy, g_win, &g_wm_delete, 1);

    XMapWindow(g_dpy, g_win);
    XFlush(g_dpy);

    fc = font_name && font_name[0] ? font_name : "fixed";
    g_font = nk_xfont_create(g_dpy, fc);
    if (!g_font) {
        XDestroyWindow(g_dpy, g_win);

eg/nuklear/nuklear_gdi.h  view on Meta::CPAN

    {
        HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
        if (mem)
        {
            SIZE_T size = GlobalSize(mem) - 1;
            if (size)
            {
                LPCWSTR wstr = (LPCWSTR)GlobalLock(mem);
                if (wstr)
                {
                    int utf8size = WideCharToMultiByte(CP_UTF8, 0, wstr, (int)(size / sizeof(wchar_t)), NULL, 0, NULL, NULL);
                    if (utf8size)
                    {
                        char* utf8 = (char*)malloc(utf8size);
                        if (utf8)
                        {
                            WideCharToMultiByte(CP_UTF8, 0, wstr, (int)(size / sizeof(wchar_t)), utf8, utf8size, NULL, NULL);
                            nk_textedit_paste(edit, utf8, utf8size);
                            free(utf8);
                        }
                    }
                    GlobalUnlock(mem);
                }
            }
        }
        CloseClipboard();
    }
}

eg/nuklear/nuklear_xlib.h  view on Meta::CPAN

    Pixmap clipMask;
};
static struct  {
    char *clipboard_data;
    int clipboard_len;
    struct nk_text_edit* clipboard_target;

    Atom xa_clipboard;
    Atom xa_targets;
    Atom xa_text;
    Atom xa_utf8_string;

    struct nk_context ctx;
    struct XSurface *surf;
    Cursor cursor;
    Display *dpy;
    Window root;
#ifdef NK_XLIB_USE_XFT
    Visual *vis;
    Colormap cmap;
#endif

eg/nuklear/nuklear_xlib.h  view on Meta::CPAN

    xlib.cmap = cmap;
#endif

    if (!setlocale(LC_ALL,"")) return 0;
    if (!XSupportsLocale()) return 0;
    if (!XSetLocaleModifiers("@im=none")) return 0;

    xlib.xa_clipboard = XInternAtom(dpy, "CLIPBOARD", False);
    xlib.xa_targets = XInternAtom(dpy, "TARGETS", False);
    xlib.xa_text = XInternAtom(dpy, "TEXT", False);
    xlib.xa_utf8_string = XInternAtom(dpy, "UTF8_STRING", False);

    /* create invisible cursor */
    {static XColor dummy; char data[1] = {0};
    Pixmap blank = XCreateBitmapFromData(dpy, root, data, 1, 1);
    if (blank == None) return 0;
    xlib.cursor = XCreatePixmapCursor(dpy, blank, blank, &dummy, &dummy, 0, 0);
    XFreePixmap(dpy, blank);}

    xlib.surf = nk_xsurf_create(screen, w, h);
    nk_init_default(&xlib.ctx, font);

eg/nuklear/nuklear_xlib.h  view on Meta::CPAN

        reply.xselection.requestor = evt->xselectionrequest.requestor;
        reply.xselection.selection = evt->xselectionrequest.selection;
        reply.xselection.target = evt->xselectionrequest.target;
        reply.xselection.property = None; /* Default refuse */
        reply.xselection.time = evt->xselectionrequest.time;

        if (reply.xselection.target == xlib.xa_targets) {
            Atom target_list[4];
            target_list[0] = xlib.xa_targets;
            target_list[1] = xlib.xa_text;
            target_list[2] = xlib.xa_utf8_string;
            target_list[3] = XA_STRING;

            reply.xselection.property = evt->xselectionrequest.property;
            XChangeProperty(evt->xselection.display,evt->xselectionrequest.requestor,
                reply.xselection.property, XA_ATOM, 32, PropModeReplace,
                (unsigned char*)&target_list, 4);
        } else if (xlib.clipboard_data && (reply.xselection.target == xlib.xa_text ||
            reply.xselection.target == xlib.xa_utf8_string || reply.xselection.target == XA_STRING)) {
            reply.xselection.property = evt->xselectionrequest.property;
            XChangeProperty(evt->xselection.display,evt->xselectionrequest.requestor,
                reply.xselection.property, reply.xselection.target, 8, PropModeReplace,
                (unsigned char*)xlib.clipboard_data, xlib.clipboard_len);
        }
        XSendEvent(evt->xselection.display, evt->xselectionrequest.requestor, True, 0, &reply);
        XFlush(evt->xselection.display);
        return 1;
    } else if (evt->type == SelectionNotify && xlib.clipboard_target) {
        if ((evt->xselection.target != XA_STRING) &&
            (evt->xselection.target != xlib.xa_utf8_string) &&
            (evt->xselection.target != xlib.xa_text))
            return 1;

        {Atom actual_type;
        int actual_format;
        unsigned long pos = 0, len, remain;
        unsigned char* data = 0;
        do {
            XGetWindowProperty(dpy, win, XA_PRIMARY, (int)pos, 1024, False,
                AnyPropertyType, &actual_type, &actual_format, &len, &remain, &data);



( run in 2.942 seconds using v1.01-cache-2.11-cpan-364913b4093 )