Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/daemon/gpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int fifofd=-1;
int eventFlag=0;
Gpm_Cinfo *cinfo[MAX_VC+1];

time_t last_selection_time;
struct timeval last_selection_time;
time_t opt_age_limit = 0;


Expand Down
4 changes: 2 additions & 2 deletions src/daemon/selection_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <fcntl.h> /* open */
#include <unistd.h> /* close */
#include <time.h> /* time */
#include <sys/time.h> /* gettimeofday */


#include "headers/message.h" /* messaging in gpm */
Expand Down Expand Up @@ -55,7 +55,7 @@ void selection_copy(int x1, int y1, int x2, int y2, int mode)

if (mode < 3) {
opt_aged = 0;
last_selection_time = time(0);
gettimeofday(&last_selection_time, NULL);
}
}

11 changes: 7 additions & 4 deletions src/daemon/selection_paste.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
********/

#include <time.h> /* time */
#include <sys/time.h> /* gettimeofday */
#include <fcntl.h> /* open */
#include <unistd.h> /* close */

Expand All @@ -30,10 +30,13 @@ void selection_paste(void)
{
char c=3;
int fd;
struct timeval now;

if (!opt_aged && (0 != opt_age_limit) &&
(last_selection_time + opt_age_limit < time(0))) {
opt_aged = 1;
if (!opt_aged && (0 != opt_age_limit)) {
gettimeofday(&now, NULL);
if (last_selection_time.tv_sec + opt_age_limit < now.tv_sec) {
opt_aged = 1;
}
}

if (opt_aged) {
Expand Down
3 changes: 2 additions & 1 deletion src/headers/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
#include "gpm.h" /* Gpm_Event */
#include <sys/select.h> /* fd_set */
#include <sys/time.h> /* timeval */

/*************************************************************************
* Types / structures
Expand Down Expand Up @@ -180,7 +181,7 @@ extern struct mouse_features mouse_table[3],
extern Gpm_Type mice[];
extern Gpm_Type *repeated_type;

extern time_t last_selection_time;
extern struct timeval last_selection_time;



Expand Down