[Re-devel] x11 tweak and pi with ubuntu MATE2 pr3v21lcd bare

Doug Blewett doug.blewett at gmail.com
Fri Apr 8 18:10:41 CEST 2016


Here are a couple of silly bits that may be of interest to the baresip
crowd.  Yesterday I installed baresip on a raspberry pi 2 using the newish
Ubuntu MATE 16.04 beta 2:

  https://ubuntu-mate.org/raspberry-pi

Pretty easy.  I had one issue with timespec struct and had to juggle the
order of the includes - other than that no problem.  I use a low end / low
power logitech camera - c270.

Quite some time ago we were hacking around with the x11 module in 0.4.16.
Here is a context diff (our group here did locally) that does the redirect
trick to avoid giving keyboard focus to the new view window.  The x11 bits
are probably not used that much any more, but here is a diff if you are
irritated by having to click back into the baresip command window.  This
also has the window dragging bits in it to allow the X11 window to be moved
around:

*** x11.c    2015-12-04 01:49:46.000000000 -0800
--- old-x11.c    2015-12-01 04:09:48.000000000 -0800
***************
*** 15,31 ****
  #include <re.h>
  #include <rem.h>
  #include <baresip.h>
- // reset the terminal on window delete - using system() - not so good
- // #include <stdlib.h>
-
- //
- // DO_REDIRECT has this program handle all of the window manager
operations
- //  and displays a borderless window.  That window does not take keyboard
- //  focus - which means the keyboard input to baresip continues.  Clicking
- //  on the window allows one to drag the window around.
- // - Blewett
- //
- #define DO_REDIRECT 1


  /**
--- 15,20 ----
***************
*** 117,125 ****

  static int create_window(struct vidisp_st *st, const struct vidsz *sz)
  {
- #ifdef DO_REDIRECT
-     XSetWindowAttributes attr;
- #endif
      st->win = XCreateSimpleWindow(st->disp, DefaultRootWindow(st->disp),
                        0, 0, sz->w, sz->h, 1, 0, 0);
      if (!st->win) {
--- 106,111 ----
***************
*** 127,146 ****
          return ENOMEM;
      }

- #ifdef DO_REDIRECT
-     //
-     // set override rediect to avoid the "kill window" button
-     //  we need to set masks to allow for mouse tracking, etc.
-     //  to control the window - making us the window manager
-     //
-     attr.override_redirect = true;
-     attr.event_mask = SubstructureRedirectMask |
-         ButtonPressMask | ButtonReleaseMask |
-         PointerMotionMask | Button1MotionMask;
-
-     XChangeWindowAttributes(st->disp, st->win,
-                 CWOverrideRedirect | CWEventMask , &attr);
- #endif
      XClearWindow(st->disp, st->win);
      XMapRaised(st->disp, st->win);

--- 113,118 ----
***************
*** 312,319 ****
  static int display(struct vidisp_st *st, const char *title,
             const struct vidframe *frame)
  {
-     static int button_is_down = 0;
-     static Time last_time = 0;
      struct vidframe frame_rgb;
      int err = 0;

--- 284,289 ----
***************
*** 322,329 ****

      /*
       * check for window delete - without blocking
-      *  the switch handles both the override redirect window
-      *  and the "standard" window manager managed window.
       */
      while (XPending(st->disp)) {

--- 292,297 ----
***************
*** 331,364 ****

          XNextEvent(st->disp, &e);

!         switch (e.type)
!                 {
!         case ButtonPress:
!             button_is_down = 1;
!                     break;
!                 case ButtonRelease:
!             button_is_down = 0;
!                     break;
!                 case MotionNotify:
!             if (button_is_down == 0)
!             break;
!             if ((e.xmotion.time - last_time) < 32)
!             break;
!             XMoveWindow(st->disp, st->win,
!                 e.xmotion.x_root - 16,
!                 e.xmotion.y_root - 16);
!             last_time = e.xmotion.time;
!             break;
!                 case EnterNotify:
!                     break;
!                 case LeaveNotify:
!                     break;
!                 case KeyPress:
!                     break;
!         case KeyRelease:
!                     break;
!
!         case ClientMessage:
              if ((Atom) e.xclient.data.l[0] == st->XwinDeleted) {

                  info("x11: window deleted\n");
--- 299,305 ----

          XNextEvent(st->disp, &e);

!         if (e.type == ClientMessage) {
              if ((Atom) e.xclient.data.l[0] == st->XwinDeleted) {

                  info("x11: window deleted\n");
***************
*** 368,375 ****
                   * pointers are bad.
                   */
                  close_window(st);
- //                system("/bin/stty sane");
- //                exit(0);
                  return ENODEV;
              }
          }
--- 309,314 ----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.creytiv.com/pipermail/re-devel/attachments/20160408/1b09ec8b/attachment.html>
-------------- next part --------------
_______________________________________________
Re-devel mailing list
Re-devel at lists.creytiv.com
http://lists.creytiv.com/mailman/listinfo/re-devel


More information about the Re-devel mailing list