alpine 3.6
obsolete weakness #24

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

xdotool/src/xdotool-3.20160805.1/cmd_behave.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

     }
  }); /* window_each(...) */

  while (True) {
    XEvent e;
    xdotool_debug(context, "Waiting for next event...");
    XNextEvent(context->xdo->xdpy, &e);
    xdotool_debug(context, "Got event type %d", e.type);

    // Copy context
    context_t tmpcontext = *context;

    tmpcontext.nwindows = 1;
    Window hover; /* for LeaveNotify */
    switch (e.type) {
      case LeaveNotify:
        /* LeaveNotify is confusing.
         * It is sometimes fired when you are actually entering the window
         * especially at the screen edges. not sure why or what causes it.
         * Work around: Query the window the mouse is over. If it is not
         * us, then we can fire leave.  */

        /* allow some time to pass to let the mouse really leave if we are on our way out */
        /* TODO(sissel): allow this delay to be tunable */
        usleep(100000); /* 100ms */
        xdo_get_window_at_mouse(context->xdo, &hover);
        if (hover == e.xcrossing.window) {
          //printf("Ignoring Leave, we're still in the window\n");
          break;
        }
        //printf("Window: %ld\n", e.xcrossing.window);
        //printf("Hover: %ld\n", hover);

        /* fall through */
      case EnterNotify:
        tmpcontext.windows = &(e.xcrossing.window);
        ret = context_execute(&tmpcontext);
        break;
      case FocusIn:
      case FocusOut:
        tmpcontext.windows = &(e.xfocus.window);
        ret = context_execute(&tmpcontext);
        break;
      case ButtonRelease:
        tmpcontext.windows = &(e.xbutton.window);
        ret = context_execute(&tmpcontext);
        break;
      default:
        printf("Unexpected event: %d\n", e.type);
        break; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.