当前位置: 首页>>代码示例>>C++>>正文


C++ xcb_map_window函数代码示例

本文整理汇总了C++中xcb_map_window函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_map_window函数的具体用法?C++ xcb_map_window怎么用?C++ xcb_map_window使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xcb_map_window函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: warning

void Client::map()
{
    if (!mFrame)
        return;
    xcb_connection_t* conn = WindowManager::instance()->connection();
    warning() << "mapping frame" << mFrame;
    xcb_map_window(conn, mWindow);
    xcb_map_window(conn, mFrame);
}
开发者ID:jhanssen,项目名称:nwm,代码行数:9,代码来源:Client.cpp

示例2: _e_alert_create

static void
_e_alert_create(void)
{
   uint32_t mask, mask_list[4];
   int wx = 0, wy = 0;

   wx = ((sw - WINDOW_WIDTH) / 2);
   wy = ((sh - WINDOW_HEIGHT) / 2);

   font = xcb_generate_id(conn);
   xcb_open_font(conn, font, strlen("fixed"), "fixed");

   /* create main window */
   mask = (XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL |
           XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK);
   mask_list[0] = screen->white_pixel;
   mask_list[1] = screen->black_pixel;
   mask_list[2] = 1;
   mask_list[3] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
                   XCB_EVENT_MASK_EXPOSURE);

   win = xcb_generate_id(conn);
   xcb_create_window(conn, XCB_COPY_FROM_PARENT, win, screen->root,
                     wx, wy, WINDOW_WIDTH, WINDOW_HEIGHT, 0,
                     XCB_WINDOW_CLASS_INPUT_OUTPUT,
                     XCB_COPY_FROM_PARENT, mask, mask_list);

   /* create button 1 */
   mask_list[3] = (XCB_EVENT_MASK_BUTTON_PRESS |
                   XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE);

   btn1 = xcb_generate_id(conn);
   xcb_create_window(conn, XCB_COPY_FROM_PARENT, btn1, win,
                     -100, -100, 1, 1, 0,
                     XCB_WINDOW_CLASS_INPUT_OUTPUT,
                     XCB_COPY_FROM_PARENT, mask, mask_list);
   xcb_map_window(conn, btn1);

   /* create button 2 */
   btn2 = xcb_generate_id(conn);
   xcb_create_window(conn, XCB_COPY_FROM_PARENT, btn2, win,
                     -100, -100, 1, 1, 0,
                     XCB_WINDOW_CLASS_INPUT_OUTPUT,
                     XCB_COPY_FROM_PARENT, mask, mask_list);
   xcb_map_window(conn, btn2);

   /* create drawing gc */
   mask = (XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT);
   mask_list[0] = screen->black_pixel;
   mask_list[1] = screen->white_pixel;
   mask_list[2] = font;

   gc = xcb_generate_id(conn);
   xcb_create_gc(conn, gc, win, mask, mask_list);
}
开发者ID:nuclearcanary,项目名称:moksha,代码行数:55,代码来源:e_alert_main.c

示例3: xcb_intern_atom_unchecked

// === EmbedWindow() ===
uint LXCB::EmbedWindow(WId win, WId container){
  if(DEBUG){ qDebug() << "XCB: EmbedWindow()"; }
  //This returns the damage control ID number (or 0 for a failure)
  if(win==0 || container==0){ return 0; }
  //qDebug() << "Embed Window:" << win << container;

  //Initialize any atoms that will be needed
  xcb_intern_atom_cookie_t ecookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 7, "_XEMBED");
  
  xcb_intern_atom_reply_t *ereply = xcb_intern_atom_reply(QX11Info::connection(), ecookie, NULL);
  if(ereply==0){ return 0; } //unable to initialize the atom
  xcb_atom_t emb = ereply->atom;
  free(ereply); //done with this structure
  
  //Reparent the window into the container
  xcb_reparent_window(QX11Info::connection(), win, container, 0, 0);
  xcb_map_window(QX11Info::connection(), win);
  
  //Now send the embed event to the app
  //qDebug() << " - send _XEMBED event";
  xcb_client_message_event_t event;
    event.response_type = XCB_CLIENT_MESSAGE;
    event.format = 32;
    event.window = win;
    event.type = emb; //_XEMBED
    event.data.data32[0] = XCB_TIME_CURRENT_TIME; //CurrentTime; 
    event.data.data32[1] = 0; //XEMBED_EMBEDDED_NOTIFY
    event.data.data32[2] = 0;
    event.data.data32[3] = container; //WID of the container
    event.data.data32[4] = 0;

    xcb_send_event(QX11Info::connection(), 0, win,  XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event);
  
  //Now setup any redirects and return
  //qDebug() << " - select Input";
  //XSelectInput(disp, win, StructureNotifyMask); //Notify of structure changes
  //uint32_t val[] = {XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY};
  //xcb_change_window_attributes(QX11Info::connection(), win, XCB_CW_EVENT_MASK, val);
  this->SelectInput(win);
  //qDebug() << " - Composite Redirect";
  xcb_composite_redirect_window(QX11Info::connection(), win, XCB_COMPOSITE_REDIRECT_MANUAL);

  //Now map the window (will be a transparent child of the container)
  xcb_map_window(QX11Info::connection(), win);
  
  //Now create/register the damage handler
  xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer
  xcb_damage_create(QX11Info::connection(), dmgID, win, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);
  
  //qDebug() << " - Done";
  return ( (uint) dmgID );	
}
开发者ID:LeFroid,项目名称:lumina,代码行数:53,代码来源:LuminaX11.cpp

示例4: main

int main(void)
{

  xcb_connection_t    *conn;
  xcb_screen_t        *screen;
  xcb_window_t         win;
  xcb_gcontext_t       gcontext;
  xcb_generic_event_t *event;
  uint32_t             mask;
  uint32_t             values[2];
  
                        /* open connection with the server */
  conn = xcb_connect(NULL,NULL);
  if (xcb_connection_has_error(conn)) {
    printf("Cannot open display\n");
    exit(1);
  }
                        /* get the first screen */
  screen = xcb_setup_roots_iterator( xcb_get_setup(conn) ).data;
 
                       /* create black graphics gcontext */
  gcontext = xcb_generate_id(conn);
  win = screen->root;
  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
  values[0] = screen->black_pixel;
  values[1] = 0;
  xcb_create_gc(conn, gcontext, win, mask, values);
 
                       /* create window */
  win = xcb_generate_id(conn);
  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
  values[0] = screen->white_pixel;
  values[1] = XCB_EVENT_MASK_EXPOSURE 
              | XCB_EVENT_MASK_KEY_PRESS
              | XCB_EVENT_MASK_KEY_RELEASE;
  xcb_create_window(conn, screen->root_depth, win, screen->root,
                    10, 10, 100, 100, 1,
                    XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual,
                    mask, values);
 
                        /* map (show) the window */
  xcb_map_window(conn, win);
 
  xcb_flush(conn);

  cterm_add_event_listener(XCB_KEY_PRESS, output_string);
  cterm_add_event_listener(XCB_KEY_PRESS, close_window);
 
                        /* event loop */
  while (!done) {
    event = xcb_poll_for_event(conn);
    if(event == NULL) continue;
    cterm_handle_event(event);
    free(event);
  }
                        /* close connection to server */
  xcb_disconnect(conn);
  cterm_free_event_handlers();
  return 0;
}
开发者ID:TheNeikos,项目名称:cterm,代码行数:60,代码来源:main.c

示例5: weston_dnd_start

static void
weston_dnd_start(struct weston_wm *wm, xcb_window_t owner)
{
	uint32_t values[1], version = 4;

	wm->dnd_window = xcb_generate_id(wm->conn);
	values[0] =
		XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
		XCB_EVENT_MASK_PROPERTY_CHANGE;

	xcb_create_window(wm->conn,
			  XCB_COPY_FROM_PARENT,
			  wm->dnd_window,
			  wm->screen->root,
			  0, 0,
			  8192, 8192,
			  0,
			  XCB_WINDOW_CLASS_INPUT_ONLY,
			  wm->screen->root_visual,
			  XCB_CW_EVENT_MASK, values);
	xcb_change_property(wm->conn,
			    XCB_PROP_MODE_REPLACE,
			    wm->dnd_window,
			    wm->atom.xdnd_aware,
			    XCB_ATOM_ATOM,
			    32, /* format */
			    1, &version);

	xcb_map_window(wm->conn, wm->dnd_window);
	wm->dnd_owner = owner;
}
开发者ID:bpeel,项目名称:weston,代码行数:31,代码来源:dnd.c

示例6: mapCurrentFrame

/* Displays all of the current windows of the frame on the screen */
void mapCurrentFrame(xcb_connection_t *conn,std::vector<xcb_window_t> (&frames)[NUM_FRAMES], int frameNum) {
  int size = frames[frameNum].size();
  std::vector<xcb_window_t> windowVector = frames[frameNum];
  for(int i=0; i<size; i++) {
    xcb_map_window(conn,windowVector.at(i));
  }
}
开发者ID:RyanBaten,项目名称:RyanBatenWindowManager,代码行数:8,代码来源:handlers.cpp

示例7: systray_update

static void
systray_update(int base_size, bool horizontal)
{
    if(base_size <= 0)
        return;

    /* Give the systray window the correct size */
    uint32_t config_vals[4] = { base_size, base_size, 0, 0 };
    if(horizontal)
        config_vals[0] = base_size * globalconf.embedded.len;
    else
        config_vals[1] = base_size * globalconf.embedded.len;
    xcb_configure_window(globalconf.connection,
                         globalconf.systray.window,
                         XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
                         config_vals);

    /* Now resize each embedded window */
    config_vals[0] = config_vals[1] = 0;
    config_vals[2] = config_vals[3] = base_size;
    for(int i = 0; i < globalconf.embedded.len; i++)
    {
        xembed_window_t *em = &globalconf.embedded.tab[i];
        xcb_configure_window(globalconf.connection, em->win,
                             XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
                             config_vals);
        xcb_map_window(globalconf.connection, em->win);
        if(horizontal)
            config_vals[0] += base_size;
        else
            config_vals[1] += base_size;
    }
}
开发者ID:raedwulf,项目名称:awesome,代码行数:33,代码来源:systray.c

示例8: create_window

xcb_window_t create_window() {
  // http://www.x.org/releases/current/doc/xproto/x11protocol.html#requests:CreateWindow
  // http://www.x.org/archive/current/doc/man/man3/xcb_create_window.3.xhtml
  //
  // N.B. xcb's order corresponds to the order of the wire.
  // You can look at the protocol encoding: http://www.x.org/releases/current/doc/xproto/x11protocol.html#Encoding::Requests
  
  uint32_t mask;
  uint32_t values[2];
  
  xcb_window_t window;
  xcb_void_cookie_t cookie;
  
  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
  values[0] = screen->white_pixel;
  values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS;
  
  window = xcb_generate_id(connection);
  cookie = xcb_create_window(connection,
			     XCB_COPY_FROM_PARENT, window, screen->root,
			     0, 0, 640, 480,
			     0,
			     XCB_WINDOW_CLASS_INPUT_OUTPUT,
			     screen->root_visual,
			     mask, values);
  
  xcb_map_window(connection, window);
  
  return window;
}
开发者ID:enn,项目名称:xcb-examples,代码行数:30,代码来源:window_event_graphics.c

示例9: xcb_wm_hints_set_iconic

void QXcbWindow::setVisible(bool visible)
{
    xcb_wm_hints_t hints;
    if (visible) {
        if (widget()->isMinimized())
            xcb_wm_hints_set_iconic(&hints);
        else
            xcb_wm_hints_set_normal(&hints);
        xcb_set_wm_hints(xcb_connection(), m_window, &hints);
        Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window));
        connection()->sync();
    } else {
        Q_XCB_CALL(xcb_unmap_window(xcb_connection(), m_window));

        // send synthetic UnmapNotify event according to icccm 4.1.4
        xcb_unmap_notify_event_t event;
        event.response_type = XCB_UNMAP_NOTIFY;
        event.sequence = 0; // does this matter?
        event.event = m_screen->root();
        event.window = m_window;
        event.from_configure = false;
        Q_XCB_CALL(xcb_send_event(xcb_connection(), false, m_screen->root(),
                                  XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event));

        xcb_flush(xcb_connection());
    }
}
开发者ID:wpbest,项目名称:copperspice,代码行数:27,代码来源:qxcbwindow.cpp

示例10: handle_map_request_event

int handle_map_request_event(void *data, xcb_connection_t *c, xcb_map_request_event_t *event)
{
    xcb_get_window_attributes_cookie_t win_attrs_cookie;
    xcb_get_window_attributes_reply_t *win_attrs_reply;
    win_attrs_cookie = xcb_get_window_attributes_unchecked(c, event->window);
    win_attrs_reply = xcb_get_window_attributes_reply(c, win_attrs_cookie, NULL);
    if (!win_attrs_reply) {
        fprintf(stderr, "map request: failed to get window attributes\n");
        return -1;
    }

    if (win_attrs_reply->override_redirect) {
        fprintf(stderr, "map request: window has override redirect set - ignoring map request\n");
        return 0;
    }

    client_t *client = NULL;

    client = find_client(event->window);
    if (!client)
        client = manage_window(event->window);

    xcb_map_window(c, event->window);

    run_arrange_hook();

    free(win_attrs_reply);

    return 0;
}
开发者ID:brandoninvergo,项目名称:nwm,代码行数:30,代码来源:nwm.c

示例11: handle_unmap_notify_event

int handle_unmap_notify_event(void *data, xcb_connection_t *c, xcb_unmap_notify_event_t *event)
{
    client_t *client = find_client(event->window);
    if (client && XCB_EVENT_SENT(event)) {
        fprintf(stderr, "unmap notify: unmapping window %u\n", client->window);
        sglib_client_t_delete(&client_list, client);
        xcb_unmap_window(wm_conf.connection, client->window);
        xcb_map_window(wm_conf.connection, event->event);
        free(client);
    }

    /* not right */
    xcb_map_window(wm_conf.connection, event->event);

    return 0;
}
开发者ID:brandoninvergo,项目名称:nwm,代码行数:16,代码来源:nwm.c

示例12: protocolsAtom

void X11WindowedBackend::createWindow()
{
    Xcb::Atom protocolsAtom(QByteArrayLiteral("WM_PROTOCOLS"), false, m_connection);
    Xcb::Atom deleteWindowAtom(QByteArrayLiteral("WM_DELETE_WINDOW"), false, m_connection);
    for (int i = 0; i < initialOutputCount(); ++i) {
        Output o;
        o.window = xcb_generate_id(m_connection);
        uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
        const uint32_t values[] = {
            m_screen->black_pixel,
            XCB_EVENT_MASK_KEY_PRESS |
            XCB_EVENT_MASK_KEY_RELEASE |
            XCB_EVENT_MASK_BUTTON_PRESS |
            XCB_EVENT_MASK_BUTTON_RELEASE |
            XCB_EVENT_MASK_POINTER_MOTION |
            XCB_EVENT_MASK_ENTER_WINDOW |
            XCB_EVENT_MASK_LEAVE_WINDOW |
            XCB_EVENT_MASK_STRUCTURE_NOTIFY |
            XCB_EVENT_MASK_EXPOSURE
        };
        o.size = initialWindowSize();
        if (!m_windows.isEmpty()) {
            const auto &p = m_windows.last();
            o.internalPosition = QPoint(p.internalPosition.x() + p.size.width(), 0);
        }
        xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, o.window, m_screen->root,
                        0, 0, o.size.width(), o.size.height(),
                        0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, mask, values);

        o.winInfo = new NETWinInfo(m_connection, o.window, m_screen->root, NET::WMWindowType, NET::Properties2());
        o.winInfo->setWindowType(NET::Normal);
        o.winInfo->setPid(QCoreApplication::applicationPid());
        QIcon windowIcon = QIcon::fromTheme(QStringLiteral("kwin"));
        auto addIcon = [&o, &windowIcon] (const QSize &size) {
            if (windowIcon.actualSize(size) != size) {
                return;
            }
            NETIcon icon;
            icon.data = windowIcon.pixmap(size).toImage().bits();
            icon.size.width = size.width();
            icon.size.height = size.height();
            o.winInfo->setIcon(icon, false);
        };
        addIcon(QSize(16, 16));
        addIcon(QSize(32, 32));
        addIcon(QSize(48, 48));

        xcb_map_window(m_connection, o.window);

        m_protocols = protocolsAtom;
        m_deleteWindowProtocol = deleteWindowAtom;
        xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, o.window, m_protocols, XCB_ATOM_ATOM, 32, 1, &m_deleteWindowProtocol);

        m_windows << o;
    }

    updateWindowTitle();

    xcb_flush(m_connection);
}
开发者ID:shadeslayer,项目名称:kwin,代码行数:60,代码来源:x11windowed_backend.cpp

示例13: towel_window_map

static void
towel_window_map(towel_window_t *win)
{
  xcb_atom_t ATOM = towel_window_get_atom(win, "ATOM");
  xcb_atom_t wm_state = towel_window_get_atom(win, "_NET_WM_STATE");
  xcb_atom_t wm_state_fullscreen = towel_window_get_atom(win, "_NET_WM_STATE_FULLSCREEN");

  xcb_client_message_event_t ev = {
    .response_type = XCB_CLIENT_MESSAGE,
    .format = 32,
    .window = win->id,
    .type = wm_state,
  };

  ev.data.data32[0] = 1;
  ev.data.data32[1] = wm_state_fullscreen;
  ev.data.data32[2] = 0;
  ev.data.data32[3] = 1;

  xcb_change_property(win->conn, XCB_PROP_MODE_REPLACE,
                      win->id, wm_state, ATOM, 8, sizeof(xcb_atom_t), &wm_state_fullscreen);
  xcb_map_window(win->conn, win->id);
}

static void
towel_window_unmap(towel_window_t *win)
{
  xcb_unmap_window(win->conn, win->id);
}
开发者ID:kanru,项目名称:towel,代码行数:29,代码来源:towel.c

示例14: main

int main()
{
    /* Open the connection to the X server */
    xcb_connection_t *connection = xcb_connect(NULL, NULL);

    /* Get the first screen */
    const xcb_setup_t  *setup = xcb_get_setup(connection);
    xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
    xcb_screen_t  *screen = iter.data;

    /* Create the window */
    xcb_window_t window = xcb_generate_id(connection);
    xcb_create_window(connection,                 /* Connection */
                      XCB_COPY_FROM_PARENT,      /* depth (same as root) */
                      window,                     /* window Id */
                      screen->root,               /* parent window */
                      0, 0,                       /* x, y */
                      150, 150,                   /* width, height */
                      10,                         /* border_width */
                      XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
                      screen->root_visual,        /* visual */
                      0, NULL);                   /* masks, not used yet */

    /* Map the window on the screen */
    xcb_map_window(connection, window);

    /* Make sure commands are sent before we pause so that the window gets shown */
    xcb_flush(connection);

    pause(); /* hold client until Ctrl-C */

    xcb_disconnect(connection);

    return 0;
}
开发者ID:suxor,项目名称:graphic-samples,代码行数:35,代码来源:create-window-test.c

示例15: xcbosd_expose

void xcbosd_expose(xcbosd *osd)
{
  assert (osd);

  lprintf("expose (state:%d)\n", osd->clean );

  switch (osd->mode) {
    case XCBOSD_SHAPED:
      xcb_shape_mask(osd->connection, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
		     osd->u.shaped.window, 0, 0, osd->u.shaped.mask_bitmap);
      if( osd->clean==DRAWN ) {

	if( !osd->u.shaped.mapped ) {
	  unsigned int stack_mode = XCB_STACK_MODE_ABOVE;
	  xcb_configure_window(osd->connection, osd->u.shaped.window, XCB_CONFIG_WINDOW_STACK_MODE, &stack_mode);
	  xcb_map_window(osd->connection, osd->u.shaped.window);
	}
	osd->u.shaped.mapped = 1;

	xcb_copy_area(osd->connection, osd->bitmap, osd->u.shaped.window,
		      osd->gc, 0, 0, 0, 0, osd->width, osd->height);
      } else {
	if( osd->u.shaped.mapped )
	  xcb_unmap_window(osd->connection, osd->u.shaped.window);
	osd->u.shaped.mapped = 0;
      }
      break;
    case XCBOSD_COLORKEY:
      if( osd->clean!=UNDEFINED )
	xcb_copy_area(osd->connection, osd->bitmap, osd->window, osd->gc, 0, 0,
		      0, 0, osd->width, osd->height);
  }
}
开发者ID:Caught,项目名称:openpliPC,代码行数:33,代码来源:xcbosd.c


注:本文中的xcb_map_window函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。