Bug in acceled Xpmac?

Nathan Ingersoll ningerso at d.umn.edu
Tue Feb 15 03:26:38 EST 2000


It looks like the accelerated Xpmac that was released in January may have
a bug in mouse handling.

I was working on a small epplet for one button mouse users to make better
use of enlightenment. When using the version of Xpmac that shipped with
LinuxPPC 1999 Q1 it worked fine. But when using the recent accelerated
version, the mouse functionality wouldn't change.

XGetPointerMapping returns the values that were set, but it doesn't seem
to be updating the way it handles the button.

Has anyone else seen similar behavior or know of a fix? I attached the
source of my program for anyone interested in trying it out.

---------------------------------------------------------------------------
|   Nathan Ingersoll             |   Computer Science/Mathematics         |
|   mailto: ningerso at d.umn.edu   |   University of Minnesota-Duluth       |
|   http://umn.edu/~ningerso     |   http://www.d.umn.edu                 |
---------------------------------------------------------------------------
-------------- next part --------------
/*
 * Copyright (C) 2000-2001, Nathan Ingersoll
 *
 * This software is licensed under the GNU General Public
 * License. If you did not receive a copy with this software,
 * it may be obtained from http://www.gnu.org/
 */

#include <stdio.h>
#include <unistd.h>
#include "epplet.h"

#define MAXBUTTON 3

Epplet_gadget close_button, label1, label2, button1;
int cur_button;
unsigned char buttons[MAXBUTTON];
char curb[2];
Display *disp;

static void close_cb(void *data);
static void in_cb(void *data, Window w);
static void out_cb(void *data, Window w);
static int delete_cb(void *data, Window win);
static void ok_cb(void *data);

static void
close_cb(void *data)
{
  Epplet_unremember();
  Esync();
  Epplet_cleanup();
  data = NULL;
  exit(0);
}

static void
in_cb(void *data, Window w)
{
  if (w == Epplet_get_main_window()) {
    Epplet_gadget_show(close_button);
  }
  return;
  data = NULL;
}

static void
out_cb(void *data, Window w)
{
  if (w == Epplet_get_main_window()) {
    Epplet_gadget_hide(close_button);
  }
  return;
  data = NULL;
}

static int
delete_cb(void *data, Window win)
{
  win = (Window) 0;
  data = NULL;
  return 1;
}

void
next_button(void *data)
{
   int b;

   XGetPointerMapping(disp, buttons, MAXBUTTON);

   b = buttons[1];
   buttons[1] = buttons[2];
   buttons[2] = buttons[0];
   buttons[0] = b;

   if (XSetPointerMapping(disp, buttons, MAXBUTTON) >= 0) {
	cur_button = buttons[0];
	Esnprintf(curb, 2, "%d", cur_button);
	Epplet_change_label(label2, curb);
   }
}

int
main(int argc, char **argv)
{

  atexit(Epplet_cleanup);

  Epplet_Init("E-UniButton", "0.1", "Mouse Button Changer", 4,3, argc, argv, 0);
  Epplet_load_config();

  disp = Epplet_get_display();
  XGetPointerMapping(disp, buttons, MAXBUTTON);
  cur_button = buttons[0];
  Esnprintf(curb, 2, "%d", cur_button);

  close_button = Epplet_create_std_button("CLOSE", 2, 2, close_cb, (void *)NULL);
  Epplet_gadget_show(label1 = Epplet_create_label(5, 10, "Button:", 3));
  Epplet_gadget_show(label2 = Epplet_create_label(48, 10, curb, 3));
  Epplet_gadget_show(button1 = Epplet_create_text_button("Next", 15, 28, 30, 12,
							next_button, (void *)NULL));
						
  Epplet_register_focus_in_handler(in_cb, NULL);
  Epplet_register_focus_out_handler(out_cb, NULL);
  Epplet_register_delete_event_handler(delete_cb, NULL);

  Epplet_show();
  Epplet_Loop();
  return 0;
}


More information about the Linuxppc-dev mailing list