Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,33 @@
[COMPILE_QT_PEER=no])
AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)

dnl -----------------------------------------------------------
dnl Haiku AWT and sound peer (enabled by default on Haiku)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([haiku-peer],
[AS_HELP_STRING(--enable-haiku-peer,compile the Haiku AWT and sound peer (disabled by --disable-jni) [default=yes on Haiku])],
[case "${enableval}" in
yes) COMPILE_HAIKU_PEER=yes ;;
no) COMPILE_HAIKU_PEER=no ;;
*) COMPILE_HAIKU_PEER=yes ;;
esac],
[case "${host_os}" in
haiku*) COMPILE_HAIKU_PEER=yes ;;
*) COMPILE_HAIKU_PEER=no ;;
esac])
if test "x${COMPILE_JNI}" != xyes; then
COMPILE_HAIKU_PEER=no
fi

Check warning on line 252 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_PROG_LIBTOOL' is obsolete.
AM_CONDITIONAL(CREATE_HAIKU_PEER_LIBRARIES, test "x${COMPILE_HAIKU_PEER}" = xyes)
if test "x${COMPILE_HAIKU_PEER}" = xyes; then
dnl The Haiku peer is the default toolkit and sound mixer when it is built.
if test "x${enable_default_toolkit}" = x; then
default_toolkit=gnu.java.awt.peer.haiku.HaikuToolkit
fi
HAIKU_MIXER_PROVIDER=gnu.javax.sound.sampled.haiku.HaikuMixerProvider
fi
AC_SUBST(HAIKU_MIXER_PROVIDER)

dnl -----------------------------------------------------------
dnl Plugin (disabled by default)
dnl -----------------------------------------------------------
Expand Down Expand Up @@ -282,7 +309,7 @@
],
[
nativeexeclibdir='${libdir}/${PACKAGE}'
])

Check warning on line 312 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_HEADER_STDC' is obsolete.

AC_SUBST(nativeexeclibdir)

Expand Down Expand Up @@ -319,13 +346,13 @@
AC_ARG_ENABLE([regen-headers],
[AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=yes if headers don't exist])],
[case "${enableval}" in
yes) REGENERATE_JNI_HEADERS=yes ;;

Check warning on line 349 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_HEADER_TIME' is obsolete.
no) REGENERATE_JNI_HEADERS=no ;;
*) REGENERATE_JNI_HEADERS=yes ;;
esac],
[if test -e ${srcdir}/include/java_lang_VMSystem.h; then
REGENERATE_JNI_HEADERS=no ;
else

Check warning on line 355 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_LINK' is obsolete.
REGENERATE_JNI_HEADERS=yes ;
fi])
AC_MSG_RESULT(${REGENERATE_JNI_HEADERS})
Expand Down Expand Up @@ -405,14 +432,14 @@
if test "x${COMPILE_JNI}" = xyes; then
GCC_ATTRIBUTE_UNUSED

AC_HEADER_STDC

Check warning on line 435 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_HEADER_STDC' is obsolete.

dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
dnl at least.
AC_COMPILE_CHECK_SIZEOF(void *)

Check warning on line 439 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_COMPILE' is obsolete.

dnl Checking for endianess.
AC_C_BIGENDIAN_CROSS

Check warning on line 442 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_FD_MSG' is obsolete.

Check warning on line 442 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_FD_MSG' is obsolete.

Check warning on line 442 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_RUN' is obsolete.

Check warning on line 442 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_COMPILE' is obsolete.

Check warning on line 442 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_COMPILE' is obsolete.

dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
Expand Down Expand Up @@ -471,7 +498,7 @@
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])

AC_HEADER_TIME

Check warning on line 501 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_HEADER_TIME' is obsolete.
AC_STRUCT_TM
AC_STRUCT_TIMEZONE

Expand Down Expand Up @@ -980,7 +1007,7 @@
esac],
[])

AX_CREATE_STDINT_H([include/config-int.h])

Check warning on line 1010 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_TRY_COMPILE' is obsolete.

dnl -----------------------------------------------------------------------
dnl Support for using a prebuilt class library
Expand Down Expand Up @@ -1021,7 +1048,7 @@
test "x${EXAMPLESDIR}" != x || \
test "x${TOOLSDIR}" != x && \
test "x${build_class_files}" != xno; then
AC_PROG_JAVAC

Check warning on line 1051 in configure.ac

View workflow job for this annotation

GitHub Actions / macos

The macro 'AC_FD_CC' is obsolete.
CLASSPATH_JAVAC_MEM_CHECK
IT_USING_ECJ

Expand Down Expand Up @@ -1142,6 +1169,7 @@
native/jni/gconf-peer/Makefile
native/jni/gstreamer-peer/Makefile
native/jni/qt-peer/Makefile
native/jni/haiku-peer/Makefile
native/jni/xmlj/Makefile
native/jni/midi-alsa/Makefile
native/jni/midi-dssi/Makefile
Expand Down
97 changes: 97 additions & 0 deletions gnu/java/awt/peer/haiku/HaikuButtonPeer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/* HaikuButtonPeer.java -- part of the Haiku AWT peer
Copyright (C) 2026 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */



package gnu.java.awt.peer.haiku;

import gnu.java.awt.peer.swing.SwingButtonPeer;

import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;

/**
* A button drawn by Swing.
*
* SwingButtonPeer calls the AWT listeners directly. This peer posts the
* ActionEvent instead, so that AWT 1.0 style action() and handleEvent()
* methods are called too.
*/
public class HaikuButtonPeer
extends SwingButtonPeer
implements java.awt.dnd.peer.DropTargetPeer
{

HaikuButtonPeer(final Button b)
{
super(b);
AbstractButton jb = (AbstractButton) swingComponent.getJComponent();
ActionListener[] l = jb.getActionListeners();
for (int i = 0; i < l.length; i++)
jb.removeActionListener(l[i]);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
HaikuSwingWrapper.post(b,
new ActionEvent(b, ActionEvent.ACTION_PERFORMED,
b.getActionCommand(), e.getWhen(),
e.getModifiers()), null);
}
});
}

/** Shows the new cursor if the mouse is over this component. */
public void setCursor(java.awt.Cursor cursor)
{
super.setCursor(cursor);
HaikuEventPump.get().refreshCursor();
}

// Drop targets are found by the event pump; nothing to register.

public void addDropTarget(java.awt.dnd.DropTarget target)
{
}

public void removeDropTarget(java.awt.dnd.DropTarget target)
{
}
}
86 changes: 86 additions & 0 deletions gnu/java/awt/peer/haiku/HaikuCheckboxMenuItemPeer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* HaikuCheckboxMenuItemPeer.java -- part of the Haiku AWT peer
Copyright (C) 2026 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */



package gnu.java.awt.peer.haiku;

import java.awt.CheckboxMenuItem;
import java.awt.EventQueue;
import java.awt.event.ItemEvent;
import java.awt.peer.CheckboxMenuItemPeer;

/**
* A checkbox menu item: a BMenuItem that shows a check mark.
*/
public class HaikuCheckboxMenuItemPeer
extends HaikuMenuItemPeer
implements CheckboxMenuItemPeer
{

HaikuCheckboxMenuItemPeer(CheckboxMenuItem item)
{
super(item);
setState(item.getState());
}

public void setState(boolean state)
{
if (item != 0)
HaikuNative.menuItemSetMarked(item, state);
}

/**
* Toggles the state and posts an ItemEvent, like other toolkits do.
*/
void activated(int modifiers)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
CheckboxMenuItem cb = (CheckboxMenuItem) awtItem;
boolean state = ! cb.getState();
cb.setState(state);
cb.dispatchEvent(new ItemEvent(cb, ItemEvent.ITEM_STATE_CHANGED,
cb.getLabel(),
state ? ItemEvent.SELECTED
: ItemEvent.DESELECTED));
}
});
}
}
Loading
Loading