openldev wrote:
Technically, you can do this with any widget by using mouse press events and motion events. Could you give an example of what you want to do? That will make it easier to point you in the right direction.
Code:
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
/* prototypes */
void
on_button_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *eventbox;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
eventbox = gtk_event_box_new ();
gtk_widget_show (eventbox);
gtk_container_add (GTK_CONTAINER (window), eventbox);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_TOOLBAR);
//gtk_window_set_opacity (window,0);
/* connect signal callbacks */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_signal_connect(GTK_OBJECT(eventbox), "button_press_event",
GTK_SIGNAL_FUNC(on_button_press), NULL);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
void
on_button_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
//event->keyval == GDK_Alt_L;
g_print("hiiiiiiiiiiiii \n");
}
and compiled
gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0` -o pointer pointer.c
but not getting the window movement...
correct the code
please help me with this code
thank you inadvance