<commit_before>/*
 * panel-action-protocol.h: _GNOME_PANEL_ACTION protocol impl.
 *
 * Copyright (C) 2003 Sun Microsystems, Inc.
 *
 * This program 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 of the
 * License, or (at your option) any later version.
 *
 * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *	<NAME> <<EMAIL>>
 */

#include <config.h>

#include "panel-action-protocol.h"
#include "panel-applets-manager.h"

#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>

#include "applet.h"
#include "panel-toplevel.h"
#include "panel-util.h"
#include "panel-run-dialog.h"

static Atom atom_gnome_panel_action            = None;
static Atom atom_gnome_panel_action_main_menu  = None;
static Atom atom_gnome_panel_action_run_dialog = None;

static void
menu_loaded_cb (GtkWidget   *widget,
                PanelWidget *panel_widget)
{
	GdkWindow *window;
	GdkRectangle rect;
	GdkDisplay *display;
	GdkSeat *seat;
	GdkDevice *device;

	window = gtk_widget_get_window (GTK_WIDGET (panel_widget));

	rect.x = 0;
	rect.y = 0;
	rect.width = 1;
	rect.height = 1;

	display = gdk_display_get_default ();
	seat = gdk_display_get_default_seat (display);
	device = gdk_seat_get_pointer (seat);

	gdk_window_get_device_position (window, device,
	                                &rect.x, &rect.y,
	                                NULL);

	gtk_menu_popup_at_rect (GTK_MENU (widget), window, &rect,
	                        GDK_GRAVITY_SOUTH_EAST,
	                        GDK_GRAVITY_NORTH_WEST,
	                        NULL);
}

static void
panel_action_protocol_main_menu (GdkScreen *screen,
				 guint32    activate_time)
{
	GSList *panels;
	GtkWidget *menu;

	if (panel_applet_activate_main_menu (activate_time))
		return;
<commit_msg>action-protocol: create fake trigger event<commit_after>/*
 * panel-action-protocol.h: _GNOME_PANEL_ACTION protocol impl.
 *
 * Copyright (C) 2003 Sun Microsystems, Inc.
 *
 * This program 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 of the
 * License, or (at your option) any later version.
 *
 * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *	<NAME> <<EMAIL>>
 */

#include <config.h>

#include "panel-action-protocol.h"
#include "panel-applets-manager.h"

#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>

#include "applet.h"
#include "panel-toplevel.h"
#include "panel-util.h"
#include "panel-run-dialog.h"

static Atom atom_gnome_panel_action            = None;
static Atom atom_gnome_panel_action_main_menu  = None;
static Atom atom_gnome_panel_action_run_dialog = None;

static void
menu_loaded_cb (GtkWidget   *widget,
                PanelWidget *panel_widget)
{
	GdkWindow *window;
	GdkRectangle rect;
	GdkDisplay *display;
	GdkSeat *seat;
	GdkDevice *device;
	GdkEvent *event;

	window = gtk_widget_get_window (GTK_WIDGET (panel_widget));

	rect.x = 0;
	rect.y = 0;
	rect.width = 1;
	rect.height = 1;

	display = gdk_display_get_default ();
	seat = gdk_display_get_default_seat (display);
	device = gdk_seat_get_pointer (seat);

	gdk_window_get_device_position (window, device,
	                                &rect.x, &rect.y,
	                                NULL);

	event = gdk_event_new (GDK_BUTTON_PRESS);
	gdk_event_set_device (event, device);

	gtk_menu_popup_at_rect (GTK_MENU (widget), window, &rect,
	                        GDK_GRAVITY_SOUTH_EAST,
	                        GDK_GRAVITY_NORTH_WEST,
	                        event);

	gdk_event_free (event);
}

static void
panel_action_protocol_main_menu (GdkScreen *screen,
				 guint32    activate_time)
{
	GSList *panels;
	GtkWidget *menu;

	if (panel_applet_activate_main_menu (activate_time))
		return;

{'fraction_non_alphanumeric': 0.09161793372319688, 'fraction_numerical': 0.005631362356508555, 'mean_word_length': 3.3118580765639587, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1539682', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1512, 'n_words': 436}