(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 27 Sep 2020, 16:56
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
xcbmsg
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4878
Location: Blue Springs, MO

PostPosted: Sat 13 Aug 2011, 20:08    Post subject:  xcbmsg
Subject description: like xmessage, but with xcb instead of X11
 

I've been trying to learn xcb programming from the small # of tutorials and this is my first somewhat useful tool to come of it.
usage:
xcbmsg "your message here"

the message window will close on any button pressed while it is active, or a mouse click in the message box.
xcbmsg.png
 Description   simple screenshot with top in the background
Notice that it uses less resources than any other running process
 Filesize   2.41 KB
 Viewed   449 Time(s)

xcbmsg.png

xcbmsg-0.1.pet
Description 
pet

 Download 
Filename  xcbmsg-0.1.pet 
Filesize  2.18 KB 
Downloaded  351 Time(s) 

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.

Last edited by technosaurus on Sat 13 Aug 2011, 22:09; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4878
Location: Blue Springs, MO

PostPosted: Sat 13 Aug 2011, 20:09    Post subject:  

Here is the
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
 
#include <xcb/xcb.h>

int main (int argc, char* argv[]){
char            *msg=argv[1];
uint8_t            msg_len = strlen(msg);
uint32_t         mask = 0, values[2];
xcb_connection_t   *c;
xcb_screen_t      *screen;
xcb_drawable_t      win;
xcb_gcontext_t      foreground,background;
xcb_generic_event_t *e;

c = xcb_connect (NULL, NULL); /* get a connection to the X server */
screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
win = screen->root;

/* create black (foreground) graphic context */
   foreground = xcb_generate_id(c);
   mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   values[0] = screen->black_pixel;
   values[1] = 0;
   xcb_create_gc(c, foreground, win, mask, values);
 
/* create white (background) graphic context */
   background = xcb_generate_id (c);
   mask = XCB_GC_BACKGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   values[0] = screen->white_pixel;
   values[1] = 0;
   xcb_create_gc(c, background, win, mask, values);
 
/* create the window */
   win = xcb_generate_id(c);
   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_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_POINTER_MOTION;
   xcb_create_window (   c, XCB_COPY_FROM_PARENT,      /* connection, depth */
                  win, screen->root,            /* window Id, parent window */
                  0, 0,                     /* x, y */
                  msg_len * 8, 14, 0,            /* width, height, border_width */
                  XCB_WINDOW_CLASS_INPUT_OUTPUT,   /* class */
                  screen->root_visual,         /* visual */
                  mask, values);               /* masks */
 
/* map the window on the screen */
   xcb_map_window (c, win);
   xcb_flush (c);
 
   while ((e = xcb_wait_for_event (c))) {
      switch (e->response_type & ~0x80) {
      case XCB_EXPOSE:
         xcb_image_text_8(c, msg_len, win, background, 1, 10, msg);
         xcb_flush(c);
         break;
      case XCB_KEY_PRESS:
         goto endloop;
      case XCB_BUTTON_PRESS:
         goto endloop;
      }
      free(e);
   }
   endloop:
 
   return 0;
}

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
jamesbond

Joined: 26 Feb 2007
Posts: 3475
Location: The Blue Marble

PostPosted: Sun 14 Aug 2011, 04:23    Post subject:  

A miniature yaf-splash!
_________________
Fatdog64 forum links: Latest version | Contributed packages | ISO builder
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1538
Location: Ukraine

PostPosted: Sun 14 Aug 2011, 05:19    Post subject:  

Dear technosaurus,

Nice...but X, on its own, is so goddamn ugly, as is yaf-splash.

With kind regards, vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0697s ][ Queries: 12 (0.0184s) ][ GZIP on ]